标签:
取完者胜.先取者负输出"Second win".先取者胜输出"First win".
2 13 10000 0
Second win Second win First win
#include <iostream> #include <cstdio> #include <cstring> #include <vector> #include <string> #include <algorithm> #include <queue> #include <set> using namespace std; int n; set<int>fib; int main(){ long long a=2,b=3,c=5; fib.insert(2); fib.insert(3); long long end = (1<<31)-1; //cout<<end<<endl; while(c <= end){ fib.insert(c); a = b; b = c; c = a+b; } while(cin >> n && n){ if(fib.count(n)==0){ cout<<"First win"<<endl; }else{ cout<<"Second win"<<endl; } } return 0; }
标签:
原文地址:http://www.cnblogs.com/mengfanrong/p/5099824.html