http://acm.hdu.edu.cn/showproblem.php?pid=1846
(一)巴什博奕(Bash
Game):只有一堆n个物品,两个人轮流从这堆物品中取物,规
定每次至少取一个,最多取m个。最后取光者得胜。的应用怎么样判断谁获胜。
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5234 Accepted Submission(s): 3476
1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 int main() 5 { 6 int t,n,m; 7 scanf("%d",&t); 8 while(t--) 9 { 10 scanf("%d%d",&n,&m); 11 if(n%(m+1)!=0) 12 printf("first\n"); 13 else 14 printf("second\n"); 15 } 16 17 return 0; 18 }
原文:http://www.cnblogs.com/cancangood/p/3513714.html