OJ编制变,以a+b为例
编制生成数据文件,命名为_random.cpp_,输出到 data.in.
#include<ctime>
#include<cstdlib>
#include<bits/stdc++.h>
using namespace std;
int main(){
freopen("data.in","w",stdout);
srand((unsigned)time(0));
cout<<rand()%2e9<<rand()%2e9;
return 0;
}
编制正确答案文件,命名为_bf.cpp_,从 data.in_读入, 输出到 _data.ans.
#include<bits/stdc++.h>
using namespace std;
int main(){
freopen("data.in","r",stdin);
freopen("data.ans","w",stdout);
cin>>a>>b;
cout<<a+b;
}
你打算提交的代码,命名为_sol.cpp_,从 data.in_读入, 输出到 _data.out.
Oj 部分,用_.ba t_文件
@echo off
:loop
random.exe > data.in
bf.exe < data.in >data.ans;
echo 开始 %time%
sol.exe < data.in > data.out
echo 结束 %time%
fc data.ans data.out
if errorlevel 1 pause
goto loop
你“抄袭”励老师的对拍……
代码是我辛辛苦苦地写的,就截了一张图而已
…………………………