#include <vector> #include <list> #include <map> #include <set> #include <unordered_map> #include <unordered_set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> #include <iostream> #include <string> #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define FORD(i,a,b) for(int i=(a);i>=(b);--i) #define REP(i,a) FOR(i,0,a) #define MP make_pair #define PB push_back #define ST first #define ND second #define VI vector<int> #define VVI vector<VI> #define PII pair<int, int> #define VII vector<PII> #define LL long long int #define ULL unsigned long long int using namespace std; const int INF = 1000*1000*1000; int main() { int casesNum; scanf("%d", &casesNum); vector<LL> fib = {0,1}; while (fib[fib.size()-1] <= INF) { fib.PB(fib[fib.size()-1] + fib[fib.size()-2]); } LL n; bool isFibo; REP(testCase, casesNum) { isFibo = false; scanf("%lld", &n); for (auto x : fib) for (auto y : fib) if (x * y == n) isFibo = true; printf(((isFibo)?("TAK\n"):("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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | #include <vector> #include <list> #include <map> #include <set> #include <unordered_map> #include <unordered_set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <ctime> #include <iostream> #include <string> #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define FORD(i,a,b) for(int i=(a);i>=(b);--i) #define REP(i,a) FOR(i,0,a) #define MP make_pair #define PB push_back #define ST first #define ND second #define VI vector<int> #define VVI vector<VI> #define PII pair<int, int> #define VII vector<PII> #define LL long long int #define ULL unsigned long long int using namespace std; const int INF = 1000*1000*1000; int main() { int casesNum; scanf("%d", &casesNum); vector<LL> fib = {0,1}; while (fib[fib.size()-1] <= INF) { fib.PB(fib[fib.size()-1] + fib[fib.size()-2]); } LL n; bool isFibo; REP(testCase, casesNum) { isFibo = false; scanf("%lld", &n); for (auto x : fib) for (auto y : fib) if (x * y == n) isFibo = true; printf(((isFibo)?("TAK\n"):("NIE\n"))); } return 0; } |