sacgajcvs

Untitled

Oct 25th, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. /*
  2. _____ _ _ _ _
  3. |_ _| |__ ___ / \ _ __ ___| |__ _ _| |
  4. | | | '_ \ / _ \ / _ \ | '_ \/ __| '_ \| | | | |
  5. | | | | | | __// ___ \| | | \__ \ | | | |_| | |
  6. |_| |_| |_|\___/_/ \_\_| |_|___/_| |_|\__,_|_|
  7.  
  8. */
  9. #include<bits/stdc++.h>
  10. #include <ext/pb_ds/assoc_container.hpp>
  11. #include <ext/pb_ds/tree_policy.hpp>
  12. #define ll long long
  13. #define pb push_back
  14. #define ppb pop_back
  15. #define endl '\n'
  16. #define mii map<ll,ll>
  17. #define msi map<string,ll>
  18. #define mis map<ll, string>
  19. #define rep(i,a,b) for(ll i=a;i<b;i++)
  20. #define repr(i,a,b) for(ll i=b-1;i>=a;i--)
  21. #define trav(a, x) for(auto& a : x)
  22. #define pii pair<ll,ll>
  23. #define vi vector<ll>
  24. #define vii vector<pair<ll, ll>>
  25. #define vs vector<string>
  26. #define all(a) (a).begin(),(a).end()
  27. #define F first
  28. #define S second
  29. #define sz(x) (ll)x.size()
  30. #define hell 1000000007
  31. #define lbnd lower_bound
  32. #define ubnd upper_bound
  33. #define max(a,b) (a>b?a:b)
  34. #define min(a,b) (a<b?a:b)
  35.  
  36. /* For Debugging */
  37. #define DEBUG cerr<<"\n>>>I'm Here<<<\n"<<endl;
  38. #define display(x) trav(a,x) cout<<a<<" ";cout<<endl;
  39. #define what_iss(x) cerr << #x << " = " << x << endl;
  40. #define what_is(x) cerr << #x << " = " << x << " ";
  41.  
  42. std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
  43. #define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
  44. #define TIME cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
  45. #define DECIMAL(n) cout << fixed ; cout << setprecision(n);
  46. #define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  47. using namespace __gnu_pbds;
  48. using namespace std;
  49. #define PI 3.141592653589793
  50. #define N 100005
  51. vi fib;
  52.  
  53.  
  54.  
  55. string fun(ll num) {
  56. if(num == 0) {
  57. return "";
  58. } else if(num == 1) {
  59. return "0";
  60. } else if(num == 2) {
  61. return "1";
  62. }
  63. ll ps = lbnd(all(fib), num) - fib.begin();
  64. string out = fun(num - fib[ps - 1]);
  65. string ext = "";
  66. rep(i,out.length(),ps - 1) {
  67. ext+="0";
  68. }
  69. out = "1" + ext + out;
  70. // what_is(num);
  71. // what_is(ps);
  72. // what_iss(out);
  73. return out;
  74. }
  75.  
  76.  
  77. void solve()
  78. {
  79. ll n;
  80. cin >> n;
  81. n++;
  82. cout << fun(n) << endl;
  83. return;
  84. }
  85. int main()
  86. {
  87. fib.pb(1);
  88. fib.pb(2);
  89. while(fib.back() <= 100000000) {
  90. fib.pb(fib.back() + fib[sz(fib) - 2]);
  91. }
  92. // display(fib);
  93. FAST
  94. int TESTS=1;
  95. cin>>TESTS;
  96. rep(i,0,TESTS)
  97. {
  98. // cout<<"Case #"<<i+1<<": ";
  99. solve();
  100. }
  101. // TIME
  102. return 0;
  103. }
Advertisement
Add Comment
Please, Sign In to add comment