#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <malloc.h>
#include <ctime>
#include <fstream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void data() { //
ofstream fout("input.txt");//将数据生成到输入(input.txt)文件里面
//下面就是根据自己的需要生成一些符合自己的数据即可
int n = rand() % 101;//根据题目限制数据大小,这里是不能大于100
int l = rand() % 101;
int r - rand() % 101;
fout << n << endl;//把 n 先写入文件中
while ( n-- ) { //接下来 n 组数据
fout << l << " " << r << endl;//每组数据两个数值,也写入input.txt文件中
}
fout.close();//这个需要记一下
}
bool test() {
data();//调用生成函数
system("test.exe");//找到并运行结果文件
system("bl.exe");
return !system("fc output_test.txt bl.txt");
//将保存结果的文件进行比对,正常返回 0,取反后返回 1
}
int main() {
srand(time(NULL));
for (int i = 0; i < 100; ++i) {
if (!test())
break;
}
return 0;
}
08-16
2607
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)