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
44
45
46
47
#include<iostream>
#include<vector>

using namespace std;

typedef vector<int> v_i;
v_i create_fib_v(int n){
    n-=2;
    v_i r;
    r.push_back(0);
    r.push_back(1);
    for(int i=0;i<n;i++){
        r.push_back(r[i] + r[i+1]);
    } 
    return r;
}

int main(){
    ios_base::sync_with_stdio(0);

    int N=46;
    v_i fib_v = create_fib_v(N);

    int n, v;
    bool w;
    cin>>n;

    for(int i=0;i<n;i++){
        cin>>v;
        if (v == 0){
            cout<<"TAK"<<endl;
            continue;
        }
        w = false;
        for(int j=1;j<N && !w;j++){
            for(int k=1;k<N;k++){
                if(v % fib_v[j] == 0 && v / fib_v[j] == fib_v[k]){
                    w = true;
                    break;
                }
            }
        }
        if(w) cout<<"TAK"<<endl;
        else cout<<"NIE"<<endl;
    }
    return 0;
}