#include <cstdio> #include <cstdlib> #include <vector> #include <algorithm> using namespace std; int main() { vector<long long> F; for (long long x=1, y=2; x<=1000000000; swap(x+=y, y)) { F.push_back(x); } int z; scanf("%d", &z); while (z--) { int x; scanf("%d", &x); try { if (!x) throw 0; for (auto a : F) { if (x<a) break; if (x%a==0 && binary_search(F.begin(), F.end(), x/a)) throw 0; } printf("NIE\n"); } catch (...) { printf("TAK\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 | #include <cstdio> #include <cstdlib> #include <vector> #include <algorithm> using namespace std; int main() { vector<long long> F; for (long long x=1, y=2; x<=1000000000; swap(x+=y, y)) { F.push_back(x); } int z; scanf("%d", &z); while (z--) { int x; scanf("%d", &x); try { if (!x) throw 0; for (auto a : F) { if (x<a) break; if (x%a==0 && binary_search(F.begin(), F.end(), x/a)) throw 0; } printf("NIE\n"); } catch (...) { printf("TAK\n"); } } return 0; } |