#include <cstdio>
#define LL long long
using namespace std;
const int F = 44;
int fib[F+5];
int t, n;
bool iloczyn(int w)
{
for(int i=0; i<=F; i++)
for(int j=0; j<=F; j++)
if((LL)fib[i] * fib[j] == w)
return 1;
return 0;
}
int main()
{
fib[1] = 1;
for(int i=2; i<=F; i++)
fib[i] = fib[i-2] + fib[i-1];
scanf("%d", &t);
while(t--)
{
scanf("%d", &n);
printf(iloczyn(n)?"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 | #include <cstdio> #define LL long long using namespace std; const int F = 44; int fib[F+5]; int t, n; bool iloczyn(int w) { for(int i=0; i<=F; i++) for(int j=0; j<=F; j++) if((LL)fib[i] * fib[j] == w) return 1; return 0; } int main() { fib[1] = 1; for(int i=2; i<=F; i++) fib[i] = fib[i-2] + fib[i-1]; scanf("%d", &t); while(t--) { scanf("%d", &n); printf(iloczyn(n)?"TAK\n":"NIE\n"); } return 0; } |
English