; YESであってもNOのときと同じ処理を行う ; つまりYES以外の数はNOである ; 10個の0を要素に持つ配列を用意し ; NOであるときの数を1つ増やす ; 最後まで0であるものを出力する (defun main () (let* ((n (read)) (s (make-array 10 :initial-element 0))) ; dotimes は指定した回数だけ反復処理を行うための構文 (dotimes (i n) (let* ((a (read)) (b (read)) (c (read)) (d (read)) (e (read))) (if (eq 'YES e) ; progn は複数の処理をまとめて順番に実行できる (progn ; map-into を使うことで破壊的な変更を行える (map-into s (lambda (x) (1+ x)) s) (setf (aref s a) (1- (aref s a))) (setf (aref s b) (1- (aref s b))) (setf (aref s c) (1- (aref s c))) (setf (aref s d) (1- (aref s d)))) (progn (setf (aref s a) (1+ (aref s a))) (setf (aref s b) (1+ (aref s b))) (setf (aref s c) (1+ (aref s c))) (setf (aref s d) (1+ (aref s d))))))) (princ ; position item sequence &key from-end test test-not start end key ; sequence内にあるitemの順序を求める (position 0 s)) (terpri))) (main)