Linux脚本

· · 个人记录

对拍

plus.cpp 里已经有 freopen 了,不需要重定向。

#!/bin/bash
name="plus"
dir="JS-S10083/$name"
code="$dir/$name"
infile="$dir/$name.in"
outfile="$dir/$name.out"
touch "$infile"
touch "$outfile"
cnt=0
while ((cnt<123)); do
    ./data > "$infile"
    ./brute < "$infile" > brute.out
    ./"$code"
    if diff -q "$outfile" brute.out; then
        echo "AC"
    else
        echo "WA"
        echo "in"
        cat "$infile"
        echo "yours"
        cat "$outfile"
        echo "std"
        cat brute.out
        exit 0
    fi
done

注:

  1. 如果 Permission denied,请用 chmod +x dps.sh 授权。
  2. 在使用 ./ 时,请先用 pwd/ls 确认当前目录是否正确。
  3. 运行脚本:
    pwd #确认
    ls #确认
    ./dps.sh