HDU1536 S-Nim(sg函数变换规则)】的更多相关文章

S-Nim Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 9829    Accepted Submission(s): 4038 Problem Description Arthur and his sister Caroll have been playing a game called Nim for some time now…
Nim or not Nim? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1056    Accepted Submission(s): 523 Problem Description Nim is a two-player mathematic game of strategy in which players take turn…
S-Nim Time Limit: 2000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64u Submit Status Description Arthur and his sister Caroll have been playing a game called Nim for some time now. Nim is played as follows: The starting position has a numb…
思路:直接打表找sg函数的值,找规律,没有什么技巧 还想了很久的,把数当二进制看,再类讨二进制中1的个数是必胜或者必败状态.... 打表: // #pragma comment(linker, "/STACK:102c000000,102c000000") #include <iostream> #include <cstdio> #include <cstring> #include <sstream> #include <str…
加强版的NIM游戏,多了一个操作,可以将一堆石子分成两堆非空的. 数据范围太大,打出sg表后找规律. # include <cstdio> # include <cstring> # include <cstdlib> # include <iostream> # include <vector> # include <queue> # include <stack> # include <map> # inc…
Nim or not Nim? Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 3032 Description Nim is a two-player mathematic game of strategy in which players take turns removing objects from distinct heaps.…
题意: 有n个盒子,每个盒子可以放一定量的石头,盒子中可能已经有了部分石头.假设石头无限,每次可以往任意一个盒子中放石头,可以加的数量不得超过该盒中已有石头数量的平方k^2,即至少放1个,至多放k^2个. 思路: 跟常规nim的区别就是加了个限制“每次加的量不超平方”.盒子容量上限是100万,那么就不能直接计算SG了,会超时.sg打表后找规律.根据剩下多少个空位来决定sg值.都是0123456这样子递增的,碰到不能一次加满就变为0,然后继续递增,一直这样. 我的方案是,对于每个盒子大小,找到除了…
题目链接 暴力出来,竟然眼花了以为sg(i) = i啊....看表要认真啊!!! #include <cstdio> #include <cstring> #include <iostream> using namespace std; #define LL __int64 ]; int sg(int x) { ],temp,i; ) return dp[x]; memset(flag,,sizeof(flag)); ;i <= x;i ++) { temp =…
Code: #include<cstdio> #include<algorithm> #include<string> #include<cstring> using namespace std; #define maxn 10003 int step[maxn],SG[maxn],m,ans,l,a,k; bool vis[maxn]; int main(){ //freopen("input.in","r",std…
Code: #include<cstdio> #include<algorithm> #include<cstring> using namespace std; #define maxn 1003 int arr[13],step[13],SG[maxn]; bool vis[maxn]; int main(){ //freopen("input.in","r",stdin); int n,m,MAX=0,ans=0; scan…