红联Linux门户
Linux帮助

windows下fc对拍器和Linux下diff对拍器

发布时间:2016-12-20 11:45:00来源:linux网站作者:zjck1995
make:生成数据的代码
test:暴力代码,一定是正确的
code:写的代码
 
windows:
g++ make.cpp -o make 
g++ test.cpp -o test
g++ code.cpp -o code
pause 
:loop 
make.exe  > in.txt
test.exe  < in.txt > outt.txt   
code.exe  < in.txt > out.txt
fc outt.txt out.txt 
if not errorlevel 1 goto loop
pause 
goto loop
 
Linux:
使用需要添加权限
chmod +x duipai.sh
#!/bin/bash
g++ make.cpp -o make
g++ test.cpp -o test
g++ code.cpp -o code
read -p "compile finished"
while true; do
./make > in
./test < in > ans
./code < in > out
if diff ans out; then
printf "AC\n"
elif diff -B -b ans out; then
printf "PE\n"
exit 0
else 
printf "WA\n"
exit 0
fi
done
 
本文永久更新地址:http://www.linuxdiyf.com/linux/27076.html