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
48
49
50
51
52
53
54
55
56
57
#include "stdio.h"

#include <algorithm>
#include <vector>

int main()
{
    std::vector<int> fibbs;

    int fib = 0;
    int fib1 = 1;
    while (true)
    {
        int fib2 = fib + fib1;
        if (fib > 1000000000)
        {
            break;
        }
        fibbs.push_back(fib);
        fib = fib1;
        fib1 = fib2;
    }
    std::vector<int> mulfibs;
    for (int i = 0; i < fibbs.size(); i++)
    {
        for (int j = i; j < fibbs.size(); j++)
        {
            unsigned long long res = (unsigned long long)fibbs[i] * fibbs[j];
            if (res <= 1000000000)
            {
                mulfibs.push_back(res);
            }
        }
    }

    std::sort(mulfibs.begin(), mulfibs.end());
    int counts;
    scanf("%d", &counts);
    for (int count = 0; count < counts; count++)
    {
        int number = 0;
        scanf("%d", &number);
        bool found = false;
        for (int i = 0; i < mulfibs.size(); i++)
        {
            if (number == mulfibs[i])
            {
                found = true;
            }
        }
        if (found)
            printf("TAK\n");
        else
            printf("NIE\n");
    }
    return 0;
}