fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3.  
  4. using namespace std;
  5.  
  6. const int MOD = 1e9 + 7;
  7.  
  8. void solve(){
  9. int n;
  10. cin >> n;
  11.  
  12. ll cnt = 2;
  13. ll sum = 1;
  14. int x = 2;
  15. while(sum + x <= n){
  16. sum += x;
  17. x++;
  18. cnt++;
  19. }
  20. int rem = n - sum;
  21. cout << "133";
  22. while(rem--){
  23. cout << "7";
  24. }
  25. cnt -= 2;
  26. while(cnt--){
  27. cout << "3";
  28. }
  29. cout << "7\n";
  30.  
  31. }
  32.  
  33. int main(){
  34. ios_base::sync_with_stdio(false);
  35. cin.tie(nullptr);
  36.  
  37. int t = 1;
  38. cin >> t;
  39.  
  40. for(int i = 1; i <= t; i++){
  41. solve();
  42. }
  43. return 0;
  44. }
Success #stdin #stdout 0s 5284KB
stdin
2
6
1
stdout
133337
1337