对拍

对拍

写一个随机数据生成器,用一份标程去跑随机生成的数据,另一份自己的程序跑数据,看有没有不一样的答案,然后对照数据修改

//01.bat
:loop
    makedata
    a
    std
    fc std.out a.out
    if %errorlevel%==0	goto loop
pause
//std.cpp
#include <bits/stdc++.h>
using namespace std;
int main()
{
	freopen("a.in","r",stdin);
    freopen("std.out","w",stdout);
    int a,b;
    cin>>a>>b;
    cout<<a+b;
    return 0;
}
//a.cpp
#include <bits/stdc++.h>
using namespace std;
int main()
{
	freopen("a.in","r",stdin);
    freopen("a.out","w",stdout);
    int a,b;
    cin>>a>>b;
    cout<<a+b;
    return 0;
}
//makedata.cpp
#include <bits/stdc++.h>
#include <cmath>
#include <ctime>
using namespace std;
int main()
{
    freopen("a.in","w",stdout);
    srand(time(0));
    cout<<rand()%100000<<" "<<rand()%100000;
    return 0;
}
posted @ 2022-09-01 21:00  钰见梵星  阅读(16)  评论(0编辑  收藏  举报