博弈论,SG函数最后就行nim就行
#include <bits/stdc++.h>
#define maxn 1005
typedef long long ll;
using namespace std;
ll f[maxn];
ll s[maxn];
ll SG[maxn];
void sg(int n)
{
for(int i = 1; i <= n; i ++)
{
memset(s,0,sizeof(s));
for(int j = 0; f[j] <= i && j < 25; j ++)
{
s[SG[i-f[j]]] = 1;
}
for(int j = 0; ; j ++)
{
if(s[j] == 0)
{
SG[i] = j;
break;
}
}
}
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
f[0] = 1;
f[1] = 2;
for(int i = 2; i <= 25; i ++)
{
f[i] = f[i-1] + f[i-2];
}
ll m,n,p;
sg(1005);
while(cin >> m >> n >> p)
{
if(m == 0 && n == 0 && p == 0)break;
if(SG[m]^SG[n]^SG[p])cout << "Fibo" << endl;
else cout << "Nacci" << endl;
}
return 0;
}