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 <iostream>
#include <stdio.h>
#include <math.h>
int sprawdz(int a, int A[]){
int x=round(sqrt(a));
int z=2;
while (A[z]<=x){ 
if (a%A[z]==0) {
int k=z;
while (A[k]<= a) {
if (a/A[z]==A[k]) return 1;
else k++;}}
z++;}
return -1;}
main(){
int A[25];
A[0]=0; A[1]=1; int i=1;
while(A[i]<32000) {
A[i+1]=A[i]+A[i-1];	
i++;} 
int a, b;
scanf("%d", &b);
for (int l=0;l<b;l++){
scanf("%d", &a);
if (a==0) printf("TAK\n");
else if (sprawdz(a, A)==1) printf("TAK\n");
else printf("NIE\n"); 
}
return 0;}