HDU--4764】的更多相关文章

题目链接: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>…
题目链接: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个,如果没有石子可取则输,这就将问题转化为巴…
今天(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…
一个组合游戏题. 解答: 从后面往前面推,首先n-1是必胜位,然后前面的k位是必败位,如此循环下去.所以题目就容易了! 代码: #include<cstdio> using namespace std; int main() { int n,k; while(scanf("%d%d",&n,&k)&&(n+k)) { ); )puts("Tang"); else puts("Jiang"); } ; }…
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…
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…
题意 Tang和Jiang玩石子游戏,给定n个石子,每次取[1,k]个石子,最先取完的人失败,Tang先取,问谁是赢家. 思路 比赛的时候想了不久,还WA了一次= =--后来看题解才发现是经典的巴什博弈,博弈什么的什么都不会= =-- [巴什博弈]只有一堆n个物品,两个人轮流从这堆物品中取物,规定每次至少取一个,最多取m个.最后取光者得胜. 分析:显然,如果n=m+1,那么由于一次最多只能取m个,所以,无论先取者拿走多少个,后取者都能够一次拿走剩余的物品,后者取胜.因此我们发现了如何取胜的法则:…
Stone Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2204    Accepted Submission(s): 1553 Problem Description Tang and Jiang are good friends. To decide whose treat it is for dinner, they are p…
Stone Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1136    Accepted Submission(s): 792 Problem Description Tang and Jiang are good friends. To decide whose treat it is for dinner, they are p…
题目链接: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…