670名無しさん@お腹いっぱい。
# bashで動いた。そっかzshでも$#だけでいいのか。
r=0
until test $# -eq 0
do
case $(( r % 4 == 0 ? 1 : (r + 3) % 4 == 0 ? 2 : (r + 2) % 2 == 0 ? 3 : 4 )) in
1) total=$(( total + ));;
2) total=$(( total - ));;
3) total=$(( total * ));;
4) total=$(( total / ));;
esac
shift
(( ++r ))
done
r=0
until test $# -eq 0
do
case $(( r % 4 == 0 ? 1 : (r + 3) % 4 == 0 ? 2 : (r + 2) % 2 == 0 ? 3 : 4 )) in
1) total=$(( total + ));;
2) total=$(( total - ));;
3) total=$(( total * ));;
4) total=$(( total / ));;
esac
shift
(( ++r ))
done
2015/05/25(月)21:53:31.12.net