Description
小A和小a在玩一個遊戲,這個遊戲是這樣的:現在有n個球,每次操作必須從中拿走k個球,不能操作者輸。因爲小A的字典序比較大(小),所以小A先手。現在問你小A是否能贏。
Input
第一行一個正整數T表示數據組數。
接下來T行每行兩個正整數n和k。
Output
如果小A能贏,則輸出YES,否則輸出NO。
Sample Input
1
10 4
Sample Output
NO
Hint
對於前30%的數據,n,k<=1000.
對於100%的數據,n,k<=10^18,T<=10
思路
哇,這麼水的題我居然爆彈哈哈,第一次用讀入優化,結果就跪了,剛好數據水,我又沒多測,就gg了,
其實就是把n/k判斷一下,若是奇數就輸出贏否則就輸。
代碼
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#define LL long long
using namespace std;
LL read()
{
LL f=1,d=0; char s=getchar() ;
while (s<48 || s>57) {if (s==45) f=-1;s=getchar() ;}
while (s>=48 && s<=57){d=d*10+s-48;s=getchar();}
return f*d;
}
int main()
{
int t;
scanf("%d" ,&t);
for (int i=1;i<=t;i++)
{
LL n,k;
// scanf("%lld %lld" ,&n,&k);
n=read();
k=read();
LL x;
x=n/k;
{
if (x%2==1)
printf("YES\n");
else
printf("NO\n");}
}
}