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
// Author: Adam Krasuski

#include <cstdio>
#include <vector>

using namespace std;

int main(){
    vector<int>fibonacci;
    fibonacci.push_back(0);
    fibonacci.push_back(1);
    while(fibonacci[fibonacci.size()-1]<=1000000000){
        fibonacci.push_back(fibonacci[fibonacci.size()-1]+fibonacci[fibonacci.size()-2]);
    }


    int t;
    scanf("%d",&t);
    for(int i=0;i<t;i++){
        int n;
        scanf("%d",&n);
        if(n==0){
            printf("TAK\n");
            continue;
        }
        int ok=0;
        for(int j=1;j<fibonacci.size();j++){
            int fib1=fibonacci[j];
            if(n%fib1==0){
                int fib2=n/fib1;
                //check if fib2 is actually a fibonacci number
                for(int k=1;k<fibonacci.size();k++){
                    if(fibonacci[k]==fib2){
                        ok=1;
                    }
                }
            }
        }
        if(ok){
            printf("TAK\n");
        }
        else{
            printf("NIE\n");
        }

    }
}