随笔分类 - 博弈
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2516博弈中的斐波那契数n =2时输出second; n =3时也是输出second; n =4时,第一个人想获胜就必须先拿1个,这时剩余的石子数为3,此时无论第二个人如何取,第一个人都能赢,输出first; n =5时,first不可能获胜,因为他取2时,second直接取掉剩下的3个就会获胜,当他取1时,这样就变成了n为4的情形,所以输出的是second; n =6时,first只要去掉1个,就可以让局势变成n为5的情形,所以输出的是first; n =7时,first取掉2个,局势变成n为5的情形,故f
阅读全文
摘要:NimTime Limit:1000MSMemory Limit:65536KTotal Submissions:4312Accepted:1998DescriptionNim is a 2-player game featuring several piles of stones. Players alternate turns, and on his/her turn, a player’s move consists of removingone or more stonesfrom any single pile. Play ends when all the stones have
阅读全文
摘要:http://poj.org/problem?id=2234Matches GameTime Limit:1000MSMemory Limit:65536KTotal Submissions:7914Accepted:4554DescriptionHere is a simple game. In this game, there are several piles of matches and two players. The two player play in turn. In each turn, one can choose a pile and take away arbitrar
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2176第三种博弈,但一定要注意优化时间 取(m堆)石子游戏Time Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1273Accepted Submission(s): 760 Problem Descriptionm堆石子,两人轮流取.只能在1堆中取.取完者胜.先取者负输出No.先取者胜输出Yes,然后输出怎样取子.例如5堆 5,7,8,9,10先取者胜,先取者.
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2149巴什博奕(Bash Game): Public SaleTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3196Accepted Submission(s): 1967 Problem Description虽然不想,但是现实总归是现实,Lele始终没有逃过退学的命运,因为他没有拿到奖学金。现在等待他的,就是像FarmJohn一样的农田生涯。要种田得有
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2188巴什博奕(Bash Game)的转换:换一种说法而已悼念512汶川大地震遇难同胞——选拔志愿者Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4620Accepted Submission(s): 2782 Problem Description对于四川同胞遭受的灾难,全国人民纷纷伸出援助之手,几乎每个省市都派出了大量的救援人员,这其中包括抢险救灾的武
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1527交换 :可实现。1 if( n 2 #include 3 int main() 4 { 5 int b,t,k,n,a; 6 while(~scanf("%d%d",&a,&b)) 7 { 8 if(a<b) 9 {10 t=a;11 a=b;12 b=t;13 }14 k=a-b;15 n=(int)k*(1+sqrt(5))/2.0;16 ...
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1846(一)巴什博奕(Bash Game):只有一堆n个物品,两个人轮流从这堆物品中取物,规定每次至少取一个,最多取m个。最后取光者得胜。的应用怎么样判断谁获胜。 Brave GameTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5234Accepted Submission(s): 3476 Problem Description十年前读大学的时候,中国
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1850//能把s态转换为T态有几种方法。 Being a Good Boy in Spring FestivalTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3574Accepted Submission(s): 2091 Problem Description一年在外 父母时刻牵挂 春节回家 你能做几天好孩子吗 寒假里尝试做做下面的事情吧陪妈妈逛一次菜场
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=2509Be the WinnerTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1646Accepted Submission(s): 879 Problem DescriptionLet's consider m apples divided into n groups. Each group contains no more than 100 a
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1907 JohnTime Limit: 5000/1000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 2385Accepted Submission(s): 1289 Problem DescriptionLittle John is playing very funny game with his younger brother. There is one big box filled wit
阅读全文

浙公网安备 33010602011771号