标签:
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 8715 Accepted Submission(s):
5643
#include<iostream> #include<cstdio> #include<cstring> using namespace std; int S[10]; int cnts=0; void getSS() { for(int i=1;i<=1000;i*=2) S[cnts++]=i; } int sg[1005]; void getSg() { int vis[1005],i,j; memset(sg,0,sizeof(sg)); for(i=1;i<1005;i++) { memset(vis,0,sizeof(vis)); for(j=0;j<cnts;j++) if(i-S[j]>=0) vis[sg[i-S[j]]]=1; for(j=0;j<1005;j++) if(vis[j]==0) break; sg[i]=j; } } int main() { getSS(); getSg(); int n; while(scanf("%d",&n)!=EOF) { if(sg[n]>0) printf("Kiki\n"); else printf("Cici\n"); } return 0; }
标签:
原文地址:http://www.cnblogs.com/jasonlixuetao/p/5890625.html