#include<stdio.h> long long fib[50]; int main() { fib[0]=0;fib[1]=1; for (int i=2;i<46;i++) fib[i]= fib[i-1]+fib[i-2]; int zes;scanf("%d",&zes); while(zes--) { long long n; scanf("%lld",&n); bool ok = false; for (int i=0;i<46;i++) { for (int j=0;j<46;j++) { long long tmp = fib[i]*fib[j]; if(tmp==n) {ok=true; break;} } if(ok) break; } if(ok)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 | #include<stdio.h> long long fib[50]; int main() { fib[0]=0;fib[1]=1; for (int i=2;i<46;i++) fib[i]= fib[i-1]+fib[i-2]; int zes;scanf("%d",&zes); while(zes--) { long long n; scanf("%lld",&n); bool ok = false; for (int i=0;i<46;i++) { for (int j=0;j<46;j++) { long long tmp = fib[i]*fib[j]; if(tmp==n) {ok=true; break;} } if(ok) break; } if(ok)printf("TAK\n"); else printf("NIE\n"); } return 0; } |