#include <cstdio>
const int ILE = 45;
long long fib[ILE];
int main()
{
fib[1] = 1;
for(int i=2; i < ILE; i++)
fib[i] = fib[i-1] + fib[i-2];
int t, czy;
scanf("%d", &t);
long long n;
while(t--)
{
scanf("%lld", &n);
czy = 0;
for(int i=0; i < ILE; i++)
for(int j=0; j < ILE; j++)
if(fib[i] * fib[j] == n)
czy = 1;
if(czy) printf("TAK\n");
else printf("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 | #include <cstdio> const int ILE = 45; long long fib[ILE]; int main() { fib[1] = 1; for(int i=2; i < ILE; i++) fib[i] = fib[i-1] + fib[i-2]; int t, czy; scanf("%d", &t); long long n; while(t--) { scanf("%lld", &n); czy = 0; for(int i=0; i < ILE; i++) for(int j=0; j < ILE; j++) if(fib[i] * fib[j] == n) czy = 1; if(czy) printf("TAK\n"); else printf("NIE\n"); } return 0; } |
English