Problem Description
ZB loves watching RunningMan! There's a game in RunningMan called 100 vs 100.
There are two teams, each of many people. There are 3 rounds of fighting, in each round the two teams send some people to fight. In each round, whichever team sends more people wins, and if the two teams send the same amount of people, RunningMan team wins. Each person can be 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 be decided before the whole game starts.
We know that there are N people on the RunningMan team, and that there are M people on the opposite team. Now zb wants to know whether there exists an arrangement of people for the RunningMan team so that they can always win, no matter how the opposite team arrange their people.
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 two integers N and M. (1 <= N, M <= 10^9).
Output
For each test case, Output "Yes" if there exists an arrangement of people so that the RunningMan team can always win. "No" if there isn't such an arrangement. (Without the quotation marks.)
Sample Input
Sample Output
Hint
In the second example, the RunningMan team can arrange 60, 60, 80 people for the three rounds. No matter how the opposite team arrange their 100 people, they cannot win.
题目大意:给定跑男团和敌方人数n,m,每队分成3组,相互pk,人数多的一方胜利,
如果两方派出人数一样, 跑男胜
问跑男团是否必胜(三盘两胜)
思路:因为跑男团必胜,所以必须有两个组大于等于敌方队伍人数,
第一次派出敌方一半(m/2)的人去
1. 如果第一局对方赢了,则派对方出的人数必须大于一半(大于m/2),剩下的人数为小于一半(小于m/2)
第二,三局跑男团只需派 (m/2) 或者 (m/2)-1 , 第二,三局就赢了 n = m/2 + m/2 + (m/2 - 1)
2. 如果第一句对方输了,假设地方队伍没有派人,那么跑男团第二,三局派出(m/2),(m/2)-1
就能在二,三局中再赢一局 n = m/2 + m/2 + (m/2 - 1)
所以 n > m*3/2 - 1 即 2*n + 2 > 3*m 即 2*n + 3 >= 3*m
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <queue>
#include <vector>
#include <cmath>
#include <stack>
#include <string>
#include <sstream>
#include <map>
#include <set>
#define pi acos(-1.0)
#define LL long long
#define ULL unsigned long long
#define inf 0x3f3f3f3f
#define INF 1e18
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define debug(a) printf("---%d---\n", a)
#define mem0(a) memset(a, 0, sizeof(a))
#define memi(a) memset(a, inf, sizeof(a))
#define mem1(a) memset(a, -1, sizeof(a))
using namespace std;
typedef pair<int, int> P;
const double eps = 1e-10;
const int maxn = 1e6 + 5;
const int mod = 1e8;
int main(void)
{
// freopen("C:\\Users\\wave\\Desktop\\NULL.exe\\NULL\\in.txt","r", stdin);
int T, n, m;
cin >> T;
while (T--){
cin >> n >> m;
if (3*m <= 2*n + 3)
puts("Yes");
else puts("No");
}
return 0;
}