#include <iostream>
#include <cstdio>
using namespace std;
long long tab[10001], t[10001], ile, n, x;
bool good;
int main() {
cin>>n;
tab[1] = 1;
tab[2] = 1;
for( int a = 3; a <= 44 ; a++ )
{
tab[a] = tab[a-1]+tab[a-2];
}
for( int a = 2; a <= 44; a++ )
{
for ( int b = 2; b <= 44; b++ )
{
t[++ile] = tab[a]*tab[b];
//cout<<ile<<" "<<t[ile]<<endl;
}
}
for( int a = 1; a <= n; a++ )
{
cin>>x;
for( int b = 1; b <= ile; b++ )
{
if( t[b] == x )
{
good = 1;
break;
}
}
if( good )
{
cout<<"TAK"<<endl;
good = 0;
}
else cout<<"NIE"<<endl;
}
//cout<<ile;
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 47 | #include <iostream> #include <cstdio> using namespace std; long long tab[10001], t[10001], ile, n, x; bool good; int main() { cin>>n; tab[1] = 1; tab[2] = 1; for( int a = 3; a <= 44 ; a++ ) { tab[a] = tab[a-1]+tab[a-2]; } for( int a = 2; a <= 44; a++ ) { for ( int b = 2; b <= 44; b++ ) { t[++ile] = tab[a]*tab[b]; //cout<<ile<<" "<<t[ile]<<endl; } } for( int a = 1; a <= n; a++ ) { cin>>x; for( int b = 1; b <= ile; b++ ) { if( t[b] == x ) { good = 1; break; } } if( good ) { cout<<"TAK"<<endl; good = 0; } else cout<<"NIE"<<endl; } //cout<<ile; return 0; } |
English