各文件如下:
1 2 3 4 5 6 7 8 9
| @echo off :loop MakeData.exe #造数据的程序 answer.exe #待对拍文件 baoli.exe #暴力(保证正确的代码) fc answer.out baoli.out #输出文件的文件名 if not errorlevel 1 goto loop pause :end
|
1 2 3 4 5 6 7 8
|
int main() { freopen("data.in","w",stdout); srand(time(NULL)); ...... }
|
1 2 3 4 5 6 7 8
|
int main() { freopen("data.in","r",stdin); freopen("answer.out","w",stdout); ...... }
|
1 2 3 4 5 6 7 8
|
int main() { freopen("data.in","r",stdin); freopen("baoli.out","w",stdout); ...... }
|
用如Dev-cpp等软件将MakeData.cpp,answer.cpp,baoli.cpp分别编译并生产.exe文件,运行Compare.bat,如果遇到答案不同时,Compare.bat将自动停下来并输出有问题的数据。