HDU 1536 sg函数】的更多相关文章

S-Nim Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7262    Accepted Submission(s): 3074 Problem Description Arthur and his sister Caroll have been playing a game called Nim for some time now.…
S-Nim Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3077    Accepted Submission(s): 1361 Problem Description Arthur and his sister Caroll have been playing a game called Nim for some time now…
kiki's game Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 40000/1000 K (Java/Others) Total Submission(s): 4972    Accepted Submission(s): 2908 Problem Description Recently kiki has nothing to do. While she is bored, an idea appears in his m…
Fibonacci again and again Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7663    Accepted Submission(s): 3205 Problem Description 任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的:F(1)=1;F(2)=2;…
Good Luck in CET-4 Everybody! Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8634    Accepted Submission(s): 5587 Problem Description 大 学英语四级考试就要来临了,你是不是在紧张的复习?也许紧张得连短学期的ACM都没工夫练习了,反正我知道的Kiki和C…
Fibonacci again and again Problem Description   任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的:F(1)=1;F(2)=2;F(n)=F(n-1)+F(n-2)(n>=3);所以,1,2,3,5,8,13……就是菲波那契数列.在HDOJ上有不少相关的题目,比如1005 Fibonacci again就是曾经的浙江省赛题.今天,又一个关于Fibonacci的题目出现了,它是一个小游戏,定义如下:1. …
Stone Game, Why are you always there? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 393    Accepted Submission(s): 132 Problem Description “Alice and Bob are playing stone game...”“Err.... Fee…
S-Nim Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5637    Accepted Submission(s): 2414 Problem Description Arthur and his sister Caroll have been playing a game called Nim for some time now.…
题目链接:http://acm.hdu.edu.cn/showproblem.php? pid=1944 pid=1536"> http://acm.hdu.edu.cn/showproblem.php?pid=1536 给定每一次能够取的石头数,给定非常多种情况,每一种情况有若干堆石头,推断先手胜负. SG函数打表,然后直接抑或.推断结果是否为0.第一次写SG函数,贴个代码,慢慢理解. 代码: /* ********************************************…
S-Nim HDU 1536 博弈 sg函数 题意 首先输入K,表示一个集合的大小,之后输入集合,表示对于这对石子只能去这个集合中的元素的个数,之后输入 一个m表示接下来对于这个集合要进行m次询问,之后m行,每行输入一个n表示有n个堆,每堆有n1个石子,问这一行所表示的状态是赢还是输,如果赢输入W否则L. 解题思路 如果没有每次取石子个数的限制的话,那么仅仅需要把每堆石子的个数进行异或运算即可,如果结果不是1,那么先手赢,反之后手赢. 但是这里对每次取石子的个数进行了限制,每次只能从几个数中进行…