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

int main ()
{
    int fib [50];
    int t, n;
    int i, j;
    bool flag;
    fib [0] = 1;
    fib [1] = 1;
    for (i = 2; i < 50; ++ i)
        fib [i] = fib [i-1] + fib [i-2];
    scanf ("%d", &t);
    for (j = 0; j < t; ++ j)
    {
        flag = false;
        scanf ("%d", &n);
        for (i = 1; fib [i] <= sqrt (n); ++ i)
            if (!(n % fib [i]) && std::binary_search (fib, fib+50, n/fib [i]))
                flag = true;
        if (flag)
            printf ("TAK\n");
        else
            printf ("NIE\n");
    }
    return 0;
}