题意 Tang和Jiang玩石子游戏,给定n个石子,每次取[1,k]个石子,最先取完的人失败,Tang先取,问谁是赢家. 思路 比赛的时候想了不久,还WA了一次= =--后来看题解才发现是经典的巴什博弈,博弈什么的什么都不会= =-- [巴什博弈]只有一堆n个物品,两个人轮流从这堆物品中取物,规定每次至少取一个,最多取m个.最后取光者得胜. 分析:显然,如果n=m+1,那么由于一次最多只能取m个,所以,无论先取者拿走多少个,后取者都能够一次拿走剩余的物品,后者取胜.因此我们发现了如何取胜的法则:…
今天(2013/9/28)长春站,最后一场网络赛! 3~5分钟后有队伍率先发现伪装了的签到题(博弈) 思路: 与取石头的巴什博弈对比 题目要求第一个人取数字在[1,k]间的某数x,后手取x加[1,k]内的某数. 将输入的n看做n个石头并编号,后一次取得的是[1,k]中的石头编号. #include<stdio.h> int main() { int n,k; while(scanf("%d%d",&n,&k)!=EOF) { &&k==)br…
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2026    Accepted Submission(s): 1428 Problem Description Tang and Jiang are good friends. To decide whose treat it is for dinner, they are playing…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4764 Problem Description Tang and Jiang are good friends. To decide whose treat it is for dinner, they are playing a game. Specifically, Tang and Jiang will alternatively write numbers (integers) on a wh…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4764 题意:Tang 和 Jiang 玩一个游戏,轮流写下一个数,Tang先手,第一次Tang只能写[1,k]之间的数,X表示上一个人写的数,Y表示下一个人写的数,每次必须满足 1<=Y-X<=k,直到有一个人写下的数不小于n,写下那个数的人失败,游戏结束,输出胜利的人. 分析:可以看做是取石子游戏,有一堆n-1个的石子,两个人轮流去石子,每次最多能去k个,如果没有石子可取则输,这就将问题转化为巴…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4764 题目大意:Tang和Jiang玩石子游戏,给定n个石子,每次取[1,k]个石子,最先取完的人失败,Tang先取,求博弈. Sample Input 1 1 30 3 10 2 0 0   Sample Output Jiang Tang Jiang 分析:可以看成是谁先取完n-1个石子,谁获胜,则变成完完全全的巴什博弈,当然要考虑特殊情况. 代码如下: #include<iostream>…
Stone Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 179    Accepted Submission(s): 137 Problem Description Tang and Jiang are good friends. To decide whose treat it is for dinner, they are pla…
Stone Game II Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 531    Accepted Submission(s): 300 Problem Description Stone Game II comes. It needs two players to play this game. There are some p…
Good Luck in CET-4 Everybody! Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 12422 Accepted Submission(s): 8056 Problem Description 大学英语四级考试就要来临了,你是不是在紧张的复习?也许紧张得连短学期的ACM都没工夫练习了,反正我知道的Kiki和Cici都是…
从n个石子中每次取p~q个,求先手能否获胜 可以先列举一部分数据,然后观察可得总是在p+q中循环,所以只要用n对p+q取模就好了 #include <cstdio> #include <cstring> #include <iostream> using namespace std; int p,q; int main() { // freopen("a.in" , "r" , stdin); int n; ) { int mod…