题意是中文,不解释了。
link:http://acm.hdu.edu.cn/showproblem.php?pid=1846
思路:就是典型的博弈论。但是不要输入while(cin>>T),不然会出现错误。
代码:
#include<iostream>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<algorithm>
using namespace std;
int main() {
int T;
int n,m;
scanf("%d",&T);
for(int t=1; t<=T; t++) {
scanf("%d%d",&n,&m);
int s=n%(m+1);
int r=n/(m+1);
if(s) {
printf("first\n");
} else {
printf("second\n");
}
}
return 0;
}