- 针对
WA
\(\longrightarrow\) 对拍!!!
例:造数据
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <iostream>
using namespace std;
int main()
{
srand(time(0));
freopen("xxx.in", "w", stdout);
int n = rand() % 1000 + 1;
int m = rand() % 1000 + 1;
int up = 1000;
cout << n << ' ' << m << '\n';
for (int i = 1; i <= n; ++i)
{
for (int j = 1; j <= m; ++j)
{
cout << rand() % up + 1 << ' ';
}
cout << '\n';
}
return 0;
}
比较:
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <iostream>
using namespace std;
int main()
{
while(1)
{
system("xxx.exe");//运行造数据的文件
system("xxx1.exe");//运行要交的代码
system("xxx2.exe");//运行暴力
if (system("fc xxx1.out xxx2.out")) break;//比较两个文件的结果
}
return 0;
}
标签:rand,exe,检查,int,system,include,考试,1000
From: https://www.cnblogs.com/xu-jh2024/p/18445729