题目:
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1846
题意:
算法:
巴什博奕。详见:博弈入门
思路:
代码:
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int t;
int n,m;
int main()
{
cin>>t;
while(t--)
{
cin>>n>>m;
if(m>=n)
cout<<"first";
else if(n%(m+1) == 0)//对于n=(m+1)r+s,s=0即先取者输
cout<<"second";
else
cout<<"first";
cout<<endl;
}
return 0;
}