結果
| 問題 | No.8044 April Sum of Odd |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-16 02:05:44 |
| 言語 | Common Lisp (sbcl 2.6.3) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 2,000 ms |
| コード長 | 754 bytes |
| 記録 | |
| コンパイル時間 | 125 ms |
| コンパイル使用メモリ | 31,360 KB |
| 実行使用メモリ | 23,424 KB |
| 最終ジャッジ日時 | 2026-05-27 11:43:10 |
| 合計ジャッジ時間 | 987 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 27 MAY 2026 11:43:07 AM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.078
ソースコード
(defun main ()
(let* ((n (read))
(m (read))
(a (make-array n)))
;; 入力を読み込む
(dotimes (i n)
(setf (aref a i) (read)))
(let ((i 0))
(loop while (< i n)
do (when (oddp (aref a i))
(let ((ans (aref a i))
(ct 1)
(j (1+ i)))
(loop while (and (< j n) (oddp (aref a j)))
do (progn
(incf ct)
(incf ans (aref a j))
(incf j)))
(when (>= ct m)
(format t "~a~%" ans))
(setf i j)))
(incf i)))))
;; Call the main function
(main)