#include <cstdio> #include <algorithm> #include <vector> using namespace std; int main() { vector<long long> V; V.push_back(0); V.push_back(1); long long a = 0, b = 1; while (b < 1000000000) { long long c = a+b; V.push_back(c); a = b; b = c; } int t; scanf("%d", &t); while (t--) { int n; scanf("%d", &n); bool ans = false; for (int i=0; i<V.size(); i++) { for (int j=0; j<V.size(); j++) { int g = V[i]*V[j]; if (g==n) { ans = true; } } } if (ans) { 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 34 35 36 37 38 | #include <cstdio> #include <algorithm> #include <vector> using namespace std; int main() { vector<long long> V; V.push_back(0); V.push_back(1); long long a = 0, b = 1; while (b < 1000000000) { long long c = a+b; V.push_back(c); a = b; b = c; } int t; scanf("%d", &t); while (t--) { int n; scanf("%d", &n); bool ans = false; for (int i=0; i<V.size(); i++) { for (int j=0; j<V.size(); j++) { int g = V[i]*V[j]; if (g==n) { ans = true; } } } if (ans) { printf("TAK\n"); } else { printf("NIE\n"); } } return 0; } |