hdu 2516 FIB博弈
分析请看:cxlove
1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 #include<cmath> 6 #include<vector> 7 #include<string> 8 #include<map> 9 #define LL long long 10 #define N 1000000 11 #define inf 1<<20 12 using namespace std; 13 int fib[50]; 14 int main(){ 15 fib[0]=1;fib[1]=2; 16 for(int i=2;i<45;i++) 17 fib[i]=fib[i-1]+fib[i-2]; 18 int n; 19 while(scanf("%d",&n)!=EOF&&n){ 20 int i=0; 21 for(i=0;i<45;i++) 22 if(fib[i]==n) 23 break; 24 if(i<45) 25 puts("Second win"); 26 else 27 puts("First win"); 28 } 29 return 0; 30 }