#include<stdio.h> int main(void) { int t; long long int n; long long int fib[50]; long long int il; int i,j; fib[0] = 0; fib[1] = 1; for(i=1; i<=45;i++) { fib[i+1] = fib[i] + fib[i-1]; } scanf("%d",&t); while(t--) { scanf("%lld",&n); //scanf("%I64d",&n); i = 0; j = 45; while(1) { if(i>j) { printf("NIE\n"); break; } il = fib[i]*fib[j]; if(il==n) { printf("TAK\n"); break; } if(il<n) { i++; } if(il>n) { j--; } } } 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 | #include<stdio.h> int main(void) { int t; long long int n; long long int fib[50]; long long int il; int i,j; fib[0] = 0; fib[1] = 1; for(i=1; i<=45;i++) { fib[i+1] = fib[i] + fib[i-1]; } scanf("%d",&t); while(t--) { scanf("%lld",&n); //scanf("%I64d",&n); i = 0; j = 45; while(1) { if(i>j) { printf("NIE\n"); break; } il = fib[i]*fib[j]; if(il==n) { printf("TAK\n"); break; } if(il<n) { i++; } if(il>n) { j--; } } } return 0; } |