准备
- 所写程序的exe文件
- 输入文件(或者生成输入文件的exe文件)
- 标程或者答案
bat文件的写法
rem //this command is annotation
rem generate.exe > test.in //this is for generate test.in
rem < for in and > for out
test.exe < test.in > out.txt
std.exe < test.in > stdout.txt
rem fc is a command to compare text
fc out.txt stdout.txt
rem diff is ok as well
直接terminal运行就好了
具体可以看我写的注释都能看懂
关于多次对拍的写法
@echo off
rem @echo off 是关掉输入显示
:hhh
rem this is a GOTO mark
rem generate.exe > test.in //this is for generate test.in
test.exe < test.in > out.txt
std.exe < test.in > stdout.txt
fc out.txt stdout.txt
if not errorlevel 1 goto hhh
pause
goto hhh
这里的循环主要用于多次运行generate.exe,适合某些需要rand输入数据的程序