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
/* 
 * File:   main.cpp
 * Author: luk
 *
 * Created on 26 kwiecień 2014, 00:12
 */

#include <cstdlib>
#include <iostream>

using namespace std;

/*
 * 
 */
int main(int argc, char** argv) {
    long long fib[100],fkw[10000],a;
    int i,j,k,n,max;
    string odp;
    fib[0]=0; fib[1]=1;
    for(i=2;i<45;i++)
        fib[i]=fib[i-1]+fib[i-2];
    fkw[0]=0;
    k=1;
    for(i=1;i<45;i++)
        for(j=1;j<=i;j++)
            fkw[k++]=fib[i]*fib[j];
    max=k;
    
    cin>>n;
    for(i=1;i<=n;i++){
        cin >> a;
        j=0;
        odp="NIE";
        while(j<max)
            if(fkw[j++]==a) odp="TAK";
        cout << odp << endl;
    }
    
    return 0;
}