#include<cstdio> #include<algorithm> #include<vector> #include<set> #include<queue> #include<stack> #include<cmath> #include<map> using namespace std; typedef pair<int,int> PI; typedef long long LL; typedef double D; #define FI first #define SE second #define MP make_pair #define PB push_back #define R(I,N) for(int I=0;I<N;I++) #define F(I,A,B) for(int I=A;I<B;I++) #define FD(I,N) for(int I=N-1;I>=0;I--) #define make(A) scanf("%d",&A) int n,_; int f(int i){ return pow((1+sqrt(5))/2,i)/sqrt(5)+0.5; } bool t(){ make(n); R(i,46)R(j,46)if(1ll * f(i) * f(j) == n)return 1; return 0; } main(){ make(_); while(_--)puts(t()?"TAK":"NIE"); }
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 | #include<cstdio> #include<algorithm> #include<vector> #include<set> #include<queue> #include<stack> #include<cmath> #include<map> using namespace std; typedef pair<int,int> PI; typedef long long LL; typedef double D; #define FI first #define SE second #define MP make_pair #define PB push_back #define R(I,N) for(int I=0;I<N;I++) #define F(I,A,B) for(int I=A;I<B;I++) #define FD(I,N) for(int I=N-1;I>=0;I--) #define make(A) scanf("%d",&A) int n,_; int f(int i){ return pow((1+sqrt(5))/2,i)/sqrt(5)+0.5; } bool t(){ make(n); R(i,46)R(j,46)if(1ll * f(i) * f(j) == n)return 1; return 0; } main(){ make(_); while(_--)puts(t()?"TAK":"NIE"); } |