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
#include<cstdio>
#include<algorithm>
using namespace std;
const int nn = 47;
int f[nn];
int main() {
	int t; scanf("%d", &t);
	f[0] = 0; f[1] = 1;
	for(int i = 2; i < nn; ++i) {
		f[i] = f[i-1] + f[i-2];
	}
	for(int i = 0; i < t; ++i) {
		int n; scanf("%d", &n);
		if (n == 0) {
			printf("TAK\n");
		 	continue;
		}
		bool ok = false;
		for(int j = 1; f[j] <= n; ++j) {
			if (n % f[j] == 0) {
				int *ii = lower_bound(f, f + nn, n / f[j]);
				if (*ii == (n / f[j])) {
						ok = true;
						continue;
				}
			}
		}
		if (!ok) {
			printf("NIE\n");
		}
		else {
			printf("TAK\n");
		}
	}
}