追梦算法----对拍模板(生成数据根据题目要求自己写,其它背模板即可)

#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;
}
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值