hdu 1856 Brave Game

来源:互联网 发布:long型数据的取值范围 编辑:程序博客网 时间:2024/06/04 19:40

题目:

    链接: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;}



0 0