#include<iostream>
#include<set>
using namespace std;
set<int> s;
int n = 1, x = 1;
int main()
{
while(x < 1000000001)
{
s.insert(x);
int z = n+x;
n = x;
x = z;
}
cin >> n;
for(int i = 0; i < n; i++)
{
cin >> x;
bool flag = false;
for(int v : s)
{
if(s.find(x/v) != s.end() && x/v*v == x)
{
cout << "TAK\n";
flag = true;
break;
}
}
if(flag != true)cout << "NIE\n";
}
}
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<iostream> #include<set> using namespace std; set<int> s; int n = 1, x = 1; int main() { while(x < 1000000001) { s.insert(x); int z = n+x; n = x; x = z; } cin >> n; for(int i = 0; i < n; i++) { cin >> x; bool flag = false; for(int v : s) { if(s.find(x/v) != s.end() && x/v*v == x) { cout << "TAK\n"; flag = true; break; } } if(flag != true)cout << "NIE\n"; } } |
English