acm对拍脚本(备份用)

1 widows

@echo off
:loop
    rand.exe > in.txt
    my.exe < in.txt > myout.txt
    std.exe < in.txt > stdout.txt
    fc myout.txt stdout.txt
if not errorlevel 1 goto loop
pause
goto loop

2 linux-已编译

#!/usr/bin/env zsh
cnt=1

while true; do
    printf "Case:%4d : " $cnt
    ((cnt++))
    ../cmake-build-debug/Apple >Apple_in.txt
    ../cmake-build-debug/Eve <Apple_in.txt >Eve.txt
    ../cmake-build-debug/Adam <Apple_in.txt >Adam.txt
    if diff Adam.txt Eve.txt; then
        printf "AC\r"
    else
        printf "Wa\n"
        break
    fi
done

3 linux-脚本编译

#!/bin/bash

g++ rand.cpp -o rand
g++ std.cpp -o std
g++ my.cpp -o my
chmod 777 rand
chmod 777 std
chmod 777 my

cnt=1

while true; do
    rand >data.in
    std <data.in >std.out
    my <data.in >my.out
    printf "Case:%4d : " $cnt
    ((cnt++))

    if diff std.out my.out; then
        printf "AC\r"
    else
        printf "Wa\n"
        break
    fi
done

rm rand
rm std
rm my

路径不全是当前路径,使用时注意下就好了

你可能感兴趣的:(acm对拍脚本(备份用))