生成数据
#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
");
else printf("no error
");
return 0;
}
过样例后一定要造数据,
用小数据找错误,大数据看边界。
然后对拍。
话说,只会打暴力的我为什么要对拍
希望不久之后我的对拍能派上用场。