---
# System prepended metadata

title: Taskcase template
tags: [note]

---

---
tags: note
---

# Taskcase template

## 2021/01/12

```cpp=
#include<iostream>
#include<vector>
#include<fstream>
#include<algorithm>
#include<random>
using namespace std;
inline string utos(const unsigned& x) {
	return string{char('0' + x / 10), char('0' + x % 10)};
}
//#define INFILE
main(int, char* argv[]) {
	string _p(argv[0]);
	const string problem(/*題號=*/_p, _p.size() - 4);
	mt19937 mt(/*亂數種子=*/hash<string>()(problem));
	vector<pair<int, int>> arr{/*測資參數=*/{0, 0}};
	for (size_t t = 0; t != arr.size(); t++) {
		/*input*/{
			fstream fin(problem + "_" + utos(t) + ".in", ios::out);
			cout.rdbuf(fin.rdbuf());
			/*************** -code- ***************/
		}
#ifdef INFILE
		/*output*/{
			fstream  fin(problem + "_" + utos(t) +  ".in", ios::in );
			fstream fout(problem + "_" + utos(t) + ".out", ios::out);
			cin.rdbuf(fin.rdbuf()), cout.rdbuf(fout.rdbuf());
			/*************** -code- ***************/
		}
#else
		/*output*/{
			string fin = problem + "_" + utos(t) +  ".in";
			string fout = problem + "_" + utos(t) + ".out";
			system(("_" + problem + " " + fin + " " + fout).data());
		}
#endif
	}
	return 0;
}
```

## ancient

```cpp
#include<iostream>
#include<vector>
#include<fstream>
#include<algorithm>
#include<random>
using namespace std;
inline string utos(const unsigned& x) {
	return string{char('0' + x / 10), char('0' + x % 10)};
}
main(int, char* argv[]) {
	string _p(argv[0]);
	const string problem(/*題號=*/_p, _p.size() - 4);
	mt19937 mt(/*亂數種子=*/hash<string>()(problem));
	vector<pair<int, int>> arr{/*測資參數=*/};
	for (size_t t = 0; t != arr.size(); t++) {
		/*input*/{
			fstream fin(problem + "_" + utos(t) + ".in", ios::out);
			cout.rdbuf(fin.rdbuf());
			/*************** -code- ***************/

		}
		/*output*/{
			fstream  fin(problem + "_" + utos(t) +  ".in", ios::in );
			fstream fout(problem + "_" + utos(t) + ".out", ios::out);
			cin.rdbuf(fin.rdbuf()), cout.rdbuf(fout.rdbuf());
			/*************** -code- ***************/

		}
	}
	return 0;
}
```