結果
| 問題 | No.8044 April Sum of Odd |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-16 02:05:44 |
| 言語 | Common Lisp (sbcl 2.5.0) |
| 結果 |
AC
|
| 実行時間 | 84 ms / 2,000 ms |
| コード長 | 754 bytes |
| 記録 | |
| コンパイル時間 | 1,368 ms |
| コンパイル使用メモリ | 35,392 KB |
| 実行使用メモリ | 30,140 KB |
| 最終ジャッジ日時 | 2024-12-20 10:40:36 |
| 合計ジャッジ時間 | 1,053 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 20 DEC 2024 10:40:34 AM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.037
ソースコード
(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)