Advertisement
vlatkovski

Output-only problem template

Jul 8th, 2019
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4.  
  5.  
  6.  
  7. void solve(ifstream& in, ofstream& out) {
  8.  
  9. }
  10.  
  11. int main() {
  12.     int tests = 10;
  13.     for (int i = 1; i <= tests; ++i) {
  14.         stringstream ss;
  15.         ss << setfill('0') << setw(2) << i;
  16.         string test_name = ss.str();
  17.         string in_full = "tests/" + test_name + ".in";
  18.         string out_full = "output/" + test_name + ".out";
  19.         ifstream in(in_full);
  20.         if (in.good()) {
  21.             ofstream out(out_full);
  22.             solve(in, out);
  23.             in.close();
  24.             out.close();
  25.         } else {
  26.             cout << "Problem reading " << in_full << "\n";
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement