Unfortunately we were unable to fully decode your file, as it is not encoded in UTF-8.
You can try to decode it yourself by downloading it here.
#include <stdio.h> #include <time.h> #include <math.h> #include <stdlib.h> #include <string.h> #include <map> #include <string> #include <vector> #include <iostream> #include <sstream> #include <queue> #include <algorithm> using namespace std; #define PB push_back #define FOR(a,start,end) for(int a=int(start); a<int(end); a++) #define INF INT_MAX #define SORT(a) sort(a.begin(),a.end()) #define CL(a,x) memset(a,x,sizeof(a)) #define REP(a,x) for(int a=0;a<x;a++) #define REP1(a,x) for(int a=1;a<=x;a++) #define MP make_pair typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<string> vs; typedef vector<pii> vii; typedef vector<vector<int> > vvi; typedef vector<vector<string> > vvs; typedef vector<pair<string,string> > vss; typedef pair<string,string> pss; typedef pair<pair<int,int>,int> ppii; typedef vector<ppii> vppii; typedef vector<vector<pii> > vvii; typedef vector<vvi> vvvi; typedef long long ll; double k0,px; int i,n,z,j,k,c,d,t; int dmax,m,a,b,kd; int cas,g,ng,p,np; int ta[100001]; int a1,b1,c1,d1; vi vk,vk2,vd,va,vb,va2,vb2; vvii vz,vzx; //vector wzor�w vii vp1,vp2; vvi vvk; //listy s�siedztwa vvii vvt; pii p1,p2,p0; vvvi vvvk; vs vw,vw2; string we; int bs(int i1, int i2, int k){ if(i1+1==i2) return -1; if(ta[(i1+i2)/2]==k) return 1; else if(ta[(i1+i2)/2]<k) return bs((i1+i2)/2,i2,k); else return bs(i1,(i1+i2)/2,k); } int main() { // freopen( "c:\\wojtek\\uva\\pa\\debug\\t3.in", "rt", stdin); // int czas=clock(); //pi=2*acos(0.0); //scanf("%ld",&t); CL(ta,0); a=1; b=1; c=1; i=0; while(c<=1000000000){ c=a+b; ta[i]=c; a=b; b=c; i++; } j=i-1; cin>>t; for(cas=0;cas<t;cas++){ cin>>n; i=0; z=1; while(ta[i]<=n){ z=0; if(n%ta[i]==0){ k=n/ta[i]; if(k<=3){ z=1; break; } if(bs(0,j,k)>0){ z=1; break; } } i++; } if(z>0) cout<<"TAK"<<endl; else cout<<"NIE"<<endl; } //czas = clock() - czas; //printf("%lf\n",double(czas)/CLOCKS_PER_SEC); 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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | #include <stdio.h> #include <time.h> #include <math.h> #include <stdlib.h> #include <string.h> #include <map> #include <string> #include <vector> #include <iostream> #include <sstream> #include <queue> #include <algorithm> using namespace std; #define PB push_back #define FOR(a,start,end) for(int a=int(start); a<int(end); a++) #define INF INT_MAX #define SORT(a) sort(a.begin(),a.end()) #define CL(a,x) memset(a,x,sizeof(a)) #define REP(a,x) for(int a=0;a<x;a++) #define REP1(a,x) for(int a=1;a<=x;a++) #define MP make_pair typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<string> vs; typedef vector<pii> vii; typedef vector<vector<int> > vvi; typedef vector<vector<string> > vvs; typedef vector<pair<string,string> > vss; typedef pair<string,string> pss; typedef pair<pair<int,int>,int> ppii; typedef vector<ppii> vppii; typedef vector<vector<pii> > vvii; typedef vector<vvi> vvvi; typedef long long ll; double k0,px; int i,n,z,j,k,c,d,t; int dmax,m,a,b,kd; int cas,g,ng,p,np; int ta[100001]; int a1,b1,c1,d1; vi vk,vk2,vd,va,vb,va2,vb2; vvii vz,vzx; //vector wzor�w vii vp1,vp2; vvi vvk; //listy s�siedztwa vvii vvt; pii p1,p2,p0; vvvi vvvk; vs vw,vw2; string we; int bs(int i1, int i2, int k){ if(i1+1==i2) return -1; if(ta[(i1+i2)/2]==k) return 1; else if(ta[(i1+i2)/2]<k) return bs((i1+i2)/2,i2,k); else return bs(i1,(i1+i2)/2,k); } int main() { // freopen( "c:\\wojtek\\uva\\pa\\debug\\t3.in", "rt", stdin); // int czas=clock(); //pi=2*acos(0.0); //scanf("%ld",&t); CL(ta,0); a=1; b=1; c=1; i=0; while(c<=1000000000){ c=a+b; ta[i]=c; a=b; b=c; i++; } j=i-1; cin>>t; for(cas=0;cas<t;cas++){ cin>>n; i=0; z=1; while(ta[i]<=n){ z=0; if(n%ta[i]==0){ k=n/ta[i]; if(k<=3){ z=1; break; } if(bs(0,j,k)>0){ z=1; break; } } i++; } if(z>0) cout<<"TAK"<<endl; else cout<<"NIE"<<endl; } //czas = clock() - czas; //printf("%lf\n",double(czas)/CLOCKS_PER_SEC); return 0; } |