#include <iostream>
#include <cstdio>
using namespace std;
typedef unsigned long long int ULL;
const int MAX_N = 46;
ULL Fib[MAX_N];
bool check(ULL n) {
for(int i=0; i<MAX_N; i++)
for(int j=0; j<MAX_N; j++)
if(Fib[i]*Fib[j]==n) return true;
return false;
}
int main(int argc, char *argv[]) {
int t,n;
Fib[1] = 1;
for(int i=2; i<MAX_N; i++)
Fib[i] = Fib[i-1] + Fib[i-2];
scanf("%d", &t);
while(t--) {
scanf("%d", &n);
if(check(n)) puts("TAK");
else puts("NIE");
}
return 0;
}
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 <iostream> #include <cstdio> using namespace std; typedef unsigned long long int ULL; const int MAX_N = 46; ULL Fib[MAX_N]; bool check(ULL n) { for(int i=0; i<MAX_N; i++) for(int j=0; j<MAX_N; j++) if(Fib[i]*Fib[j]==n) return true; return false; } int main(int argc, char *argv[]) { int t,n; Fib[1] = 1; for(int i=2; i<MAX_N; i++) Fib[i] = Fib[i-1] + Fib[i-2]; scanf("%d", &t); while(t--) { scanf("%d", &n); if(check(n)) puts("TAK"); else puts("NIE"); } return 0; } |
English