Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.02 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int numTest;
  5.  
  6. string Convert(int num) {
  7.     string ans = "";
  8.     while (num > 0) ans += (char) ('0' + num%10), num /= 10;
  9.     reverse(ans.begin(), ans.end());
  10.  
  11.     if (ans.length() == 1) ans = "00" + ans;
  12.     else if (ans.length() == 2) ans = "0" + ans;
  13.  
  14.     return ans;
  15. }
  16.  
  17.  
  18. void Lets_gen() {
  19.     ofstream GEN("input.txt", ofstream::out);
  20.     int n = rand() % (int) 1e5 + 1;
  21.     GEN << n << '\n';
  22.     for (int i = 1; i <= n; ++i) GEN << rand() % (int) 1e9 + 1 << " ";
  23.     GEN.close();
  24. }
  25.  
  26.  
  27. int main() {
  28.     srand(time(NULL));
  29.  
  30.     cout << "NumTest : ";
  31.     cin >> numTest;
  32.  
  33.     for (int T = 1; T <= numTest; ++T) {
  34.         // system( "gen.exe" );
  35.         Lets_gen();
  36.         system( "prob.exe" );
  37.  
  38.         string ID = Convert(T);
  39.         string INP = "input" + ID + ".txt";
  40.         string OUT = "output" + ID + ".txt";
  41.  
  42.         system( ("ren input.txt " + INP).c_str() );
  43.         system( ("ren output.txt " + OUT).c_str() );
  44.  
  45.         system( ("move " + INP + " input").c_str() );
  46.         system( ("move " + OUT + " output").c_str() );
  47.     }
  48.  
  49.     return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement