您的位置:首页 > 运维架构 > Linux

Linux Bash对拍

2020-06-29 05:02 1271 查看

代码:

#!/bin/bash

while true; do
./rand > input //数据生成器
./test < input > output //测试程序
./std < input > stdout //标程

if diff output stdout; then
printf "Accepted\n" //正确
else
printf "Wrong Answer\n" //错误
break
fi

sleep 0.2 //暂停0.2s
done

步骤:

  1. 将代码存储为judge.sh
  2. 在终端运行 chmod +x judge.sh
  3. 在终端运行 ./judge.sh

转载于:https://www.cnblogs.com/Krew/p/6705922.html

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: