1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <set>

using namespace std;
long long f[45];
set<int> s;

main() {
        f[0]=0; f[1]=1;
        int i,j, n, k;
        for (int i=2; i<45; i++)
                f[i]=f[i-1]+f[i-2];

        for (int i=1; i<45; i++)
                for (int j=0; j<=i; j++)
                        if (f[i]*f[j] <=1000000000)
                                s.insert(f[i]*f[j]);

        cin>>n;
        for (int i=0;i<n; i++) {
                cin>>k;
                if (s.find(k)!=s.end())
                        cout<<"TAK"<<endl;
                else
                        cout<<"NIE"<<endl;
        }
        return 0;
}