hdoj 1846 Brave Game

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1846

解题思路:典型的巴什博弈(巴什博弈:http://www.cnblogs.com/linqiuwei/p/3227146.html

 1 ///////////////////////////////////////////////////////////////////////////
 2 //problem_id: hdoj 1846
 3 //user_id: SCNU20102200088
 4 ///////////////////////////////////////////////////////////////////////////
 5 
 6 #include <algorithm>
 7 #include <iostream>
 8 #include <iterator>
 9 #include <iomanip>
10 #include <cstring>
11 #include <cstdlib>
12 #include <string>
13 #include <vector>
14 #include <cstdio>
15 #include <cctype>
16 #include <cmath>
17 #include <queue>
18 #include <stack>
19 #include <list>
20 #include <set>
21 #include <map>
22 using namespace std;
23 
24 ///////////////////////////////////////////////////////////////////////////
25 typedef long long LL;
26 const double EPS=1e-8;
27 const double PI=acos(-1.0);
28 
29 const int x4[]={-1,0,1,0};
30 const int y4[]={0,1,0,-1};
31 const int x8[]={-1,-1,0,1,1,1,0,-1};
32 const int y8[]={0,1,1,1,0,-1,-1,-1};
33 
34 typedef int T;
35 T max(T a,T b){ return a>b? a:b; }
36 T min(T a,T b){ return a<b? a:b; }
37 ///////////////////////////////////////////////////////////////////////////
38 
39 ///////////////////////////////////////////////////////////////////////////
40 //Add Code:
41 ///////////////////////////////////////////////////////////////////////////
42 
43 int main(){
44     ///////////////////////////////////////////////////////////////////////
45     //Add Code:
46     int C,n,m;
47     scanf("%d",&C);
48     while(C--){
49         scanf("%d%d",&n,&m);
50         printf("%s
",n%(m+1)!=0? "first":"second");
51     }
52     ///////////////////////////////////////////////////////////////////////
53     return 0;
54 }
55 
56 ///////////////////////////////////////////////////////////////////////////
57 /*
58 Testcase:
59 Input:
60 2
61 23 2
62 4 3
63 Output:
64 first
65 second
66 */
67 ///////////////////////////////////////////////////////////////////////////
原文地址:https://www.cnblogs.com/linqiuwei/p/3286201.html