Niestety, nie byliśmy w stanie w pełni poprawnie wyświetlić tego pliku, ponieważ nie jest zakodowany w UTF-8.
Możesz pobrać ten plik i spróbować otworzyć go samodzielnie.
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
vector<long long> v;
long long t[50];
int main()
{
int x1=1,x2=2,x3=3,dl=3,y;
t[1]=x1;
t[2]=x2;
t[3]=x3;
v.push_back(0);
v.push_back(1);
while (x3<=1000000000)
{
dl++;
x1=x2;
x2=x3;
x3=x1+x2;
t[dl]=x3;
}
//s� 44 takie liczby
for (int i=1; i<=44; i++)
{
int j=2;
while (t[i]*t[j]<=1000000000)
{
v.push_back(t[i]*t[j]);
j++;
}
}
sort(v.begin(),v.end());
int t;
long long n;
scanf("%d", &t);
for (int i=1; i<=t; i++)
{
int x=0;
scanf("%lld", &n);
while(v[x] <n) x++;
if (v[x] == n) printf("TAK\n");
else printf("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 34 35 36 37 38 39 40 41 42 43 44 45 | #include <cstdio> #include <vector> #include <algorithm> using namespace std; vector<long long> v; long long t[50]; int main() { int x1=1,x2=2,x3=3,dl=3,y; t[1]=x1; t[2]=x2; t[3]=x3; v.push_back(0); v.push_back(1); while (x3<=1000000000) { dl++; x1=x2; x2=x3; x3=x1+x2; t[dl]=x3; } //s� 44 takie liczby for (int i=1; i<=44; i++) { int j=2; while (t[i]*t[j]<=1000000000) { v.push_back(t[i]*t[j]); j++; } } sort(v.begin(),v.end()); int t; long long n; scanf("%d", &t); for (int i=1; i<=t; i++) { int x=0; scanf("%lld", &n); while(v[x] <n) x++; if (v[x] == n) printf("TAK\n"); else printf("NIE\n"); } } |
English