zl程序教程

您现在的位置是:首页 >  其他

当前栏目

对拍程序

2023-09-11 14:19:24 时间

Linux中,新建dp.sh,内容如下:

#!/bin/bash
while true ;do
#   ./gen >in
#   ./bruteforce <in >ans
#   ./my <in >out
#   if diff out ans; then
    ./$1 <$2.in >out
    if diff -b -y --suppress-common-lines out $2.out ; then
        echo AC
    else
        echo WA
        break;
    read p
    fi
    sleep 1
done

执行./dp.sh
gen 是生成数据的程序,bruteforce 是暴力的程序,my 是我要测试的程序。
diff 的参数-b是忽略空格引起的变化,-y是使用并列格式输出,--suppress-common-lines 是在并列格式中不印出公共行。
ps.来源是学长们留下的板子上的,然后我加上了参数。