"Problem Description" |
"Title description" |
ZB loves watching runningman! There ' s a game in Runningman called vs. There is teams, each of many people. There is 3 rounds of fighting, in each round the and the teams send some people to fight. In each round, whichever team sends more people wins, and if the both teams send the same amount of people, Runningman team Wins. Each person can is sent out to only one round. The team wins 2 rounds win the whole game. Note, the arrangement of the fighter in three rounds must is decided before the whole game starts. We know that there is N people on the Runningman team, and that there is M people on the opposite team. Now ZB wants to know whether there exists a arrangement of people for the Runningman team so it they can always win, no Matter how the opposite team arrange their people. |
ZB recently became obsessed with the Running Man (han)! There is a game called "100" in the Running Man. Now there are two teams, each with several people. In the three-round contest, each round of the two teams sent a number of people to contest. In each round, a larger team wins, and if both teams have the same number, the male team wins. Each person can only play once, three innings and two wins. Note that the three-round number arrangement must be decided before the game starts. We know that there are n men on the men's team and there are m people in the enemy team. Now ZB want to know if there is a winning platoon in the running men, let the opponent helpless. |
"Input" |
Input |
The first line contains an integer T, meaning the number of the cases. 1 <= T <= 50. For each test case, there's one line consists of the integers n and M. (1 <= N, M <= 10^9). |
The first line has an integer t, which indicates the number of samples. 1 <= T <= 50. Each test sample has only one row, two integers n, M per line. (1 <= N, M <= 10^9). |
"Output" |
Output |
For each test case, the Output "Yes" if there exists a arrangement of people so and the Runningman team can always win. "No" If there isn ' t such an arrangement. (without the quotation marks.) |
For each test sample, if there is a running men winning team rule output "Yes", otherwise output "No". (The output has no quotation marks.) ) |
"Sample input-Input Sample" |
"Sample output-Output Example" |
2 100 100 200 100 |
No Yes |
"Hint" |
Prompted |
In the second example, the Runningman team can arrange, and the people for the three rounds. No matter how the opposite team arrange their people, they cannot win. |
For each test sample, if there is a running men winning team rule output "Yes", otherwise output "No". (The output has no quotation marks.) ) |
Exercises
Note that the number is >=1.
Then for the enemy team, the best strategy is: win the least, lose the most, the left to look at the face.
So here's the following:
Running male team for X = 3Xmin + C1 Enemy team for Y = 3Ymin + C2
In order to the enemy team in the first wave caused the biggest consumption, here xmin is as large as possible, so c1=0.
Or the team can be status quo, can be directly as X = 3Xmin.
(Lazy cancer episode, proof slightly)
And then write down the best strategy for the enemy team to win the men's team.
Y (ymin+1) ≤ (x-xmin)/2
To simplify:
2y-2≤x+xmin
Y-1≤2 Xmin (lazy cancer attack)
Y-1≤ (2/3) X
Note that here are all mathematical operations, the division of INT will appear the problem of precision, can be solved with double.
Or into an integer form 3*y≤2*x+3 (int will be out of bounds, maximum value 4 billion, int Max 2.1 billion +, can use unsigned int or __int64, and note subtraction when unsigned)
"Code C + +"
1#include <cstdio>2 intMain () {3Unsignedintx, y, T;4scanf"%u", &t);5 while(t--){6scanf"%u%u", &x, &y);7 if(3* Y <=2* x +3) puts ("Yes");8 ElsePuts"No");9 }Ten return 0; One}
Fzu 2221 Runningman (Running Man)