結果
| 問題 | No.24 数当てゲーム |
| コンテスト | |
| ユーザー |
Common Lisp
|
| 提出日時 | 2024-10-06 03:26:41 |
| 言語 | Common Lisp (sbcl 2.6.9) |
| 結果 |
AC
不安定
|
| 実行時間 | 6 ms / 5,000 ms |
| + 514µs | |
| コード長 | 1,365 bytes |
| 記録 | |
| コンパイル時間 | 108 ms |
| コンパイル使用メモリ | 36,468 KB |
| 実行使用メモリ | 27,388 KB |
| 最終ジャッジ日時 | 2026-10-11 02:13:30 |
| 合計ジャッジ時間 | 1,374 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 11 OCT 2026 02:13:28 AM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.009
ソースコード
; 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)
Common Lisp