#include <iostream> int main() { long int a,b=0,c=1,d,e,f,g; int x,z=0; std::cin >> x; for(int y=0; y < x; y++) { std::cin >> a; if( a == 0 ) { std::cout << "TAK\n"; } else { while( d < a && d * g != a) { e = b; f = c; g = 0; d = b + c; b = c; c = d; while( d * g < a && !(e + f > a) ) { g = e + f; e = f; f = g; if( g * d == a ) { std::cout << "TAK\n"; z = 1; } } } if( z == 0 ) { std::cout << "NIE\n"; } b=0; c=1; d=0; z=0; } } 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 | #include <iostream> int main() { long int a,b=0,c=1,d,e,f,g; int x,z=0; std::cin >> x; for(int y=0; y < x; y++) { std::cin >> a; if( a == 0 ) { std::cout << "TAK\n"; } else { while( d < a && d * g != a) { e = b; f = c; g = 0; d = b + c; b = c; c = d; while( d * g < a && !(e + f > a) ) { g = e + f; e = f; f = g; if( g * d == a ) { std::cout << "TAK\n"; z = 1; } } } if( z == 0 ) { std::cout << "NIE\n"; } b=0; c=1; d=0; z=0; } } return 0; } |