思路:找规律。先写个暴力程序,然后发现凡是斐波那契数,都是后手赢,否则先手赢。。。我也不知道为什么。。暴力程序在代码中被注释。
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstdlib>
#include <string>
#include <memory.h>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <ctype.h>
#define ll long long
#define max3(a,b,c) max(a,max(b,c))
using namespace std;
/*
//暴力递归,x表示石子数,m表示能取的最大量
bool fun(int x,int m){
if(x==0)return 0;
bool ok=0;
for(int i=1;i<=m;i++){
if(fun(x-i,min(i*2,x-i))==0)return 1;
}
return 0;
}
*/
int main(){
ll n;
while(cin>>n){
if(n==0)break;
int a=1,b=1;
bool ok=1;
while(1){
int t=a;
a=a+b;
b=t;
if(a==n){
ok=0;
break;
}
if(a>n){
break;
}
}
if(ok){
cout<<"First win"<<endl;
}else{
cout<<"Second win"<<endl;
}
}
return 0;
}