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
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>

#define intas int

using namespace std;

unsigned long long int tab[50];

int main()
{
    intas n;
    scanf("%d", &n);
    tab[0] = 0;
    tab[1] = 1;
    for( int i = 2; i < 50; i ++ )
    {
        tab[i] = tab[i-1] + tab[i-2];
    }
    for( int i = 0; i < n; i ++ )
    {
        int F;
        scanf("%d", &F);
        bool flag = false;
        if( F == 0 ) flag = true;
        for( int j = 1; j < 50; j ++ )
        {
            if( tab[j] * tab[j] > F ) break;
            if( F % tab[j] == 0 )
            {
                int G = F / tab[j];
                bool found = binary_search( tab, tab + 50, G );
                if( found == true )
                {
                    flag = true;
                    break;
                }
            }
        }
        if( flag == true ) printf("TAK\n");
        else printf("NIE\n");
    }
    return 0;
}