#include <iostream> #include <cstdio> using namespace std; typedef long long LL; int t, n; int F[100]; bool result; int main () { F[0] = 0; F[1] = 1; for (int i = 2; i < 45; ++i) F[i] = F[i - 1] + F[i - 2]; scanf("%d",&t); while (t--) { scanf("%d",&n); result = false; for (int i = 0; i < 45; ++i) for (int j = 0; j < 45; ++j) { if ((LL)(F[i]) * (LL)(F[j]) == (LL)(n)) { result = true; } } if (result == true) printf("TAK\n"); else printf("NIE\n"); } 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 | #include <iostream> #include <cstdio> using namespace std; typedef long long LL; int t, n; int F[100]; bool result; int main () { F[0] = 0; F[1] = 1; for (int i = 2; i < 45; ++i) F[i] = F[i - 1] + F[i - 2]; scanf("%d",&t); while (t--) { scanf("%d",&n); result = false; for (int i = 0; i < 45; ++i) for (int j = 0; j < 45; ++j) { if ((LL)(F[i]) * (LL)(F[j]) == (LL)(n)) { result = true; } } if (result == true) printf("TAK\n"); else printf("NIE\n"); } return 0; } |