对拍器
对拍器代码
#include <fstream>
void solve() {
ifstream input1;
// 你的代码运行的输出
input1.open("../output.txt");
ifstream input2;
// 正确的代码的输出
input2.open("../compare/output.txt");
int n = 10, m = 10;
int T = 10;
for (int t = 1; t <= T; t ++) {
for (int i = 1; i <= n + m + 1; i ++) {
int x, y;
input1 >> x;
input2 >> y;
if (x != y) {
cout << "WA on test" << t << " on " << i << '\n';
}
}
cout << "AC on test" << t << '\n';
}
}
随机数据生成
#include <random>
mt19937_64 rnd(1064);
int rd(int l, int r) {return rnd() % (r - l + 1) + l;}
int a[100];
void solve() {
int t = 10;
cout << t << '\n';
while (t --) {
int n = 10, m = 10;
cout << n << ' ' << m << '\n';
for (int i = 1; i <= n + m + 1; i ++) {
a[i] = rd(1, 100);
cout << a[i] << ' ';
}
cout << '\n';
for (int i = 1; i <= n + m + 1; i ++) {
int x = rd(1, 100);
while (x == a[i]) x = rd(1, 100);
cout << x << ' ';
}
cout << '\n';
}
}
以上代码均需要针对不同问题做修改。
标签:
对拍器
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】