Advertisement
bappi2097

asd

Aug 30th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef unsigned long long int ull;
  4. map<int,bool> mp;
  5. map<int,bool>::iterator it,it2;
  6. int gcd(int a,int b)
  7. {
  8. if(a%b==0)
  9. return b;
  10. return gcd(b,a%b);
  11. }
  12. void fib()
  13. {
  14. ull a=0,b=1,c=0;
  15. mp[0]=true;
  16. mp[1]=true;
  17. for(int i=0; c<100005; i++)
  18. {
  19. c=a+b;
  20. mp[c]=true;
  21. swap(a,b);
  22. b=c;
  23. mp[c]=false;
  24. }
  25. }
  26. int main()
  27. {
  28. ios_base::sync_with_stdio(false);
  29. cin.tie(NULL);
  30. #ifndef ONLINE_JUDGE
  31. freopen("input.txt","r",stdin);
  32. #endif // ONLINE_JUDGE
  33. fib();
  34. int t;
  35. cin>>t;
  36. int n[t];
  37. for(int i=0; i<t; i++)
  38. cin>>n[i];
  39. for(int i=0; i<t; i++)
  40. {
  41. int cnt=0;
  42. it=mp.begin();
  43. it++;
  44. it2=it;
  45. it++;
  46. //cout<<gcd(it->first,it2->first)<<endl;
  47. for(it; it->first<n[i]; it++)
  48. {
  49. cout<<1<<endl;
  50. for(it2; it2->first<n[i]; it2++)
  51. {
  52. int ab=(it->first)+(it2->first);
  53. cout<<ab<<endl;
  54. if(mp[ab])
  55. {
  56. cout<<2<<endl;
  57. if(gcd(it->first,it2->first)==1)
  58. {
  59. cout<<3<<endl;
  60. if((it->first+it2->first)%2==1)
  61. {
  62. cout<<4<<endl;
  63. cnt++;
  64. }
  65. }
  66. swap(it,it2);
  67. if(gcd(it->first,it2->first)==1)
  68. {
  69. if((it->first+it2->first)%2==1)
  70. {
  71. cnt++;
  72. }
  73. }
  74. swap(it,it2);
  75. }
  76. }
  77.  
  78. }
  79. //cout<<cnt<<endl;
  80. }
  81. return 0;
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement