fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. ll INF = 1000000000000000000LL;
  5. ll dp[123];
  6.  
  7. void pre()
  8. {
  9. dp[1] = 1; dp[2] = 2; dp[3] = 3;
  10. for (int i = 4; ; ++i){
  11. if (INF - dp[i-1] < dp[i-3]) break;
  12. dp[i] = dp[i-1] + dp[i-3];
  13. }
  14. }
  15.  
  16. void solve()
  17. {
  18. ll n;
  19. cin >> n;
  20. int s[200], pos = 108;
  21. memset(s, 0, sizeof(s));
  22. while (n>0){
  23. if (n >= dp[pos]){
  24. s[pos] = 1;
  25. n -= dp[pos];
  26. }
  27. pos -= 1;
  28. }
  29. int fin = 199;
  30. while (!s[fin])--fin;
  31. for(int i = fin; i>0; i--)
  32. cout << s[i];
  33. cout << endl;
  34. }
  35.  
  36. int main()
  37. {
  38. pre();
  39. int t;
  40. cin >> t;
  41. while (t--)solve();
  42. return 0;
  43. }
  44.  
Success #stdin #stdout 0s 3144KB
stdin
10
5
6
7
1
2
3
10
9
8
4
stdout
1001
10000
10001
1
10
100
100001
100000
10010
1000