Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef unsigned long long int ull;
- map<int,bool> mp;
- map<int,bool>::iterator it,it2;
- int gcd(int a,int b)
- {
- if(a%b==0)
- return b;
- return gcd(b,a%b);
- }
- void fib()
- {
- ull a=0,b=1,c=0;
- mp[0]=true;
- mp[1]=true;
- for(int i=0; c<100005; i++)
- {
- c=a+b;
- mp[c]=true;
- swap(a,b);
- b=c;
- mp[c]=false;
- }
- }
- int main()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- #ifndef ONLINE_JUDGE
- freopen("input.txt","r",stdin);
- #endif // ONLINE_JUDGE
- fib();
- int t;
- cin>>t;
- int n[t];
- for(int i=0; i<t; i++)
- cin>>n[i];
- for(int i=0; i<t; i++)
- {
- int cnt=0;
- it=mp.begin();
- it++;
- it2=it;
- it++;
- //cout<<gcd(it->first,it2->first)<<endl;
- for(it; it->first<n[i]; it++)
- {
- cout<<1<<endl;
- for(it2; it2->first<n[i]; it2++)
- {
- int ab=(it->first)+(it2->first);
- cout<<ab<<endl;
- if(mp[ab])
- {
- cout<<2<<endl;
- if(gcd(it->first,it2->first)==1)
- {
- cout<<3<<endl;
- if((it->first+it2->first)%2==1)
- {
- cout<<4<<endl;
- cnt++;
- }
- }
- swap(it,it2);
- if(gcd(it->first,it2->first)==1)
- {
- if((it->first+it2->first)%2==1)
- {
- cnt++;
- }
- }
- swap(it,it2);
- }
- }
- }
- //cout<<cnt<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement