#include <iostream>
#include <vector>
const long long MAXN = 1000LL * 1000LL * 1000LL * 1000LL;
std::vector<long long> fib;
int main() {
fib.push_back(0);
fib.push_back(1);
while (fib.back() < MAXN) {
fib.push_back(fib.back() + *(fib.rbegin()+1));
}
int t;
std::cin >> t;
while (t --> 0) {
long long n;
std::cin >> n;
bool result = false;
for (auto x : fib) {
for (auto y : fib) {
result |= ((x * y) == n);
}
}
std::cout << (result ? "TAK" : "NIE") << std::endl;
}
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 <vector> const long long MAXN = 1000LL * 1000LL * 1000LL * 1000LL; std::vector<long long> fib; int main() { fib.push_back(0); fib.push_back(1); while (fib.back() < MAXN) { fib.push_back(fib.back() + *(fib.rbegin()+1)); } int t; std::cin >> t; while (t --> 0) { long long n; std::cin >> n; bool result = false; for (auto x : fib) { for (auto y : fib) { result |= ((x * y) == n); } } std::cout << (result ? "TAK" : "NIE") << std::endl; } return 0; } |
English