https://www.cnblogs.com/ECJTUACM-873284962/p/6921829.html
hdu 1848
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#define maxn 1005
#define ll long long
using namespace std;
bool book[maxn];
int SG[maxn];
int fib[maxn];
void getSG(int n)
{
for(int i=1;i<=n;i++)
{
memset(book,false,sizeof(book));
for(int j=1;fib[j]<=i;j++)
{
book[SG[i-fib[j]]]=true;
}
for(int u=0;;u++)
{
if(!book[u])
{
SG[i]=u;
break;
}
}
}
}
int main()
{
ios::sync_with_stdio(false);
int m,n,q;
fib[1]=1;fib[2]=2;
for(int i=3;i<=maxn;i++)
fib[i]=fib[i-1]+fib[i-2];
while(cin>>m>>n>>q)
{
if(!m&&!n&&!q)
break;
getSG(1000);
if(SG[m]^SG[n]^SG[q])
cout << "Fibo\n";
else
cout << "Nacci\n";
}
}