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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>

using namespace std;

int main()
{
    int t, i, l, SIZE=24;
    long n, d;
    long fib[SIZE];

    fib[0]=fib[1] = 1;
    for(i=2; i<SIZE; i++)
        fib[i]=fib[i-2]+fib[i-1];
    cin>>t;
    while(t--)
    {
        cin>>n;
        if(0 == n || 1 == n)
            cout<<"TAK"<<endl;
        else
        {
            for(i=0; i<SIZE; i++)
                if(0==n%fib[i])
                {
                    d = n/fib[i];
                    for(l=0; l<SIZE; l++)
                        if(fib[l] == d)
                            break;
                    if(l<SIZE)
                    {
                        cout<<"TAK"<<endl;
                        break;
                    }

                }

            if(i == SIZE)
                cout<<"NIE"<<endl;
        }
    }

    return 0;
}