先上题目:
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 5113 Accepted Submission(s): 3271
1 #include <iostream> 2 #include <cstring> 3 #define MAX 1002 4 using namespace std; 5 6 int sg[MAX]; 7 bool has[MAX]; 8 9 void solve(){ 10 memset(sg,0,sizeof(sg)); 11 for(int i=1;i<=1000;i++){ 12 memset(has,0,sizeof(has)); 13 14 for(int j=1;j<=i;j<<=1){ 15 has[sg[i-j]]=1; 16 } 17 18 for(int j=0;j<=i;j++){ 19 if(!has[j]){ 20 sg[i]=j; 21 break; 22 } 23 } 24 } 25 } 26 27 int main() 28 { 29 int n; 30 ios::sync_with_stdio(false); 31 solve(); 32 while(cin>>n){ 33 if(sg[n]!=0) cout<<"Kiki"<<endl; 34 else cout<<"Cici"<<endl; 35 } 36 return 0; 37 }
HDU - 1847 -Good Luck in CET-4 Everybody!,布布扣,bubuko.com
HDU - 1847 -Good Luck in CET-4 Everybody!
原文:http://www.cnblogs.com/sineatos/p/3887544.html