- 数据生成
#include <bits/stdc++.h>
using namespace std;
signed main() {
mt19937_64 rd(chrono::system_clock::now().time_since_epoch().count());
uniform_int_distribution<int> dis(1e7, 1e9);
for (int i = 1; i <= 10; i++) {
string IN = "coin" + to_string(i) + ".in";
ofstream out(IN.c_str());
out << dis(rd) << endl;
}
return 0;
}
- 对拍
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int T = 100, n = 1000, q = n;
signed main() {
mt19937_64 rd(chrono::system_clock::now().time_since_epoch().count());
uniform_int_distribution<int> dis(-1000000, 1000000);
for (int t = 1; t <= T; t++) {
vector<pair<int, int> > V;
vector<int> X;
ofstream out("data.in");
out << n << '\n';
for (int i = 1; i <= n; i++) {
int k = dis(rd), b = dis(rd);
if (k == 0) k++;
out << k << ' ' << b << '\n';
V.emplace_back(k, b);
}
out << q << '\n';
for (int i = 1; i <= q; i++) {
int x = dis(rd);
out << x << '\n';
X.push_back(x);
}
out.flush();
system("std.exe");
system("test1.exe");
ifstream in1("std.out");
vector<ll> Ans1(q);
for (int i = 0; i < q; i++) in1 >> Ans1[i];
ifstream in2("test.out");
vector<ll> Ans2(q);
for (int i = 0; i < q; i++) in2 >> Ans2[i];
if (Ans1 != Ans2) {
cout << "Case " << t << " WA!" << '\n';
cout << "input :" << '\n';
cout << n << '\n';
for (auto p : V) cout << p.first << ' ' << p.second << '\n';
cout << q << '\n';
for (int x : X) cout << x << '\n';
cout << '\n';
cout << "output :" << '\n';
for (ll ans2 : Ans2) cout << ans2 << '\n';
cout << '\n';
cout << "right ans :" << '\n';
for (ll ans1 : Ans1) cout << ans1 << '\n';
cout << '\n';
exit(0);
}
else cout << "Case " << t << " AC!" << '\n';
}
return 0;
}
标签:int,Ans1,Ans2,64,using,杂项,out
From: https://www.cnblogs.com/wkh2008/p/18012251