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

int main()
{
   int tab[50] = {0,1};
   for(int i = 1; tab[i] < 1000000000; i++)
      tab[i + 1] = tab[i] + tab[i - 1];
   
   int n, x;
   scanf("%d", &n);
   for(int i = 0; i < n; i++)
   {
      scanf("%d", &x);
      if(x == 0)
      {
         printf("TAK\n");
         continue;
      }
      bool bFound = false;
      for(int idx = 1; tab[idx] * tab[idx] <= x; idx++)
      {
         if(x % tab[idx] == 0)
         {
            int k = x / tab[idx];
            for(int idk = 1; tab[idk] <= k; idk ++)
            {
               if(tab[idk] == k)
                  bFound = true;
            }
         }
      }
      if(bFound)
         printf("TAK\n");
      else
         printf("NIE\n");
   }
}