对拍

生成数据

#include <cstdio>
#include <iostream>
#include <ctime>
#include <windows.h> 

using namespace std;
int main()
{
	srand(time(0));
	int a, b;
	a = rand()%100 + 1;
	b = rand()%100 + 1;
	printf("%d %d",a,b); 
	return 0;
}

对拍

#include <cstdio>
#include <iostream>
#include <windows.h>

using namespace std;
int main()
{
	int t = 10;
	while(--t)
	{
		system("data.exe > data.txt");
		system("a+b.exe < data.txt > a+b.txt");
		system("baoli.exe < data.txt > baoli.txt");
		if(system("fc a+b.txt  baoli.txt"))  break;
	}
	if(t != 0) printf("error\n");
	else printf("no error\n");
	return 0;
}

过样例后一定要造数据,
用小数据找错误,大数据看边界。
然后对拍。

话说,只会打暴力的我为什么要对拍
希望不久之后我的对拍能派上用场。

posted @ 2020-12-01 19:40  _程门立雪  阅读(113)  评论(2编辑  收藏  举报