sg函数大神详解:http://blog.csdn.net/luomingjun12315/article/details/45555495
模板:
int f[N],SG[N]; bool S[M]; void getSG(int n) { memset(SG,0,sizeof(SG)); for(int i=1;i<=n;i++) { memset(S,false,sizeof(S)); for(int j=1;f[j]<=i&&j<M;j++) { S[SG[i-f[j]]]=true; } for(int j=0;;j++) if(!S[j]) { SG[i]=j; break; } } }
例题:http://www.cnblogs.com/widsom/p/7171428.html
http://www.cnblogs.com/widsom/p/7170891.html
时间: 2024-08-04 01:34:13