hdu1846

简单博弈论

n%(m+1)==0 则后手胜

n%(m+1)>0 则先手胜

 1 #include<iostream>
 2 using namespace std;
 3 
 4 int main()
 5 {
 6     int c,n,m;
 7     cin>>c;
 8     while(c--){
 9         cin>>n>>m;
10         int x=n%(m+1);
11         if(x>0) cout<<"first"<<endl;
12         else  cout<<"second"<<endl;
13     }
14     return 0;
15 }
View Code
原文地址:https://www.cnblogs.com/moomight/p/11196470.html