Skip to content

Instantly share code, notes, and snippets.

@aeurielesn
Created January 28, 2011 17:05
Show Gist options
  • Save aeurielesn/800562 to your computer and use it in GitHub Desktop.
Save aeurielesn/800562 to your computer and use it in GitHub Desktop.
A simple script to judge problems using Bash
#!/bin/bash
cnt=0
ZERO=0
for i in {1..10}
do
if [ -f $1.out ]
then
rm $1.out
fi
cp test-data/$1/$1.in.$i $1.in
time $2
ans=`diff $1.out test-data/$1/$1.out.$i | wc -l`
if [ -f $1.out ] && [ "$ans" = "$ZERO" ]; then
echo "$i: OK"
cnt=$[$cnt+1]
else
echo "$i: WA"
fi
done
echo $cnt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment