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
#include <iostream>
#include <stdlib.h>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

void generateFibonaccisTill(int number, vector<int> &list)
{
	int newObject = 0;
	while (newObject < number)
	{
		newObject = list.at(list.size() - 1) + list.at(list.size() - 2);
		list.push_back(newObject);
	}
}

int main(void)
{
	int count, actualNumber;
	string answer, ultimateAnswer = "";

	vector<int> fibonacciNumbers{ 1, 2 };

	cin >> count;

	for (int iterator = 0; iterator < count; iterator++)
	{
		cin >> actualNumber;
		if (actualNumber > fibonacciNumbers.at(fibonacciNumbers.size() - 1))
			generateFibonaccisTill(actualNumber, fibonacciNumbers);

		for (int iterator2 = 0; iterator2 < fibonacciNumbers.size(); iterator2++)
		{
			if ((float)actualNumber / fibonacciNumbers.at(iterator2) - actualNumber / fibonacciNumbers.at(iterator2) == 0)
			{
				if (find(fibonacciNumbers.begin(), fibonacciNumbers.end(), actualNumber / fibonacciNumbers.at(iterator2)) != fibonacciNumbers.end())
				{
					answer = "TAK";
					break;
				}
			}
			answer = "NIE";
		}

		ultimateAnswer += answer + "\n";
	}

	cout << ultimateAnswer;
	return 0;
}