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
#include <stdio.h>

int main (int argc, char** argv) {
    unsigned int inp_no;
    unsigned long check_product;
    unsigned long *fib;
    unsigned int number = 50;
    bool indicator;

    fib = new unsigned long [number];
    fib[0]=0;
    fib[1]=1;
    for(int i=2;i<50;i++) {
        fib[i]=fib[i-1]+fib[i-2];
    }
    scanf("%d",&inp_no);
    for(int i=1;i<=inp_no;i++){
        scanf("%lu",&check_product);
        indicator=false;
        for(int a=1;a<50;a++){
            for(int b=1;b<50;b++){
                if(fib[a]*fib[b]==check_product){
                    indicator=true;
                    break;
                }
                if(fib[a]*fib[b]>check_product)
                    break;
            }
            if(indicator)
                break;
        }
        if(indicator)
            printf("TAK\n");
        else
            printf("NIE\n");
    }
    return 0;
}