結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
|
| 提出日時 | 2021-04-01 17:07:14 |
| 言語 | Scheme (Gauche-0.9.15) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 5,000 ms |
| コード長 | 427 bytes |
| コンパイル時間 | 388 ms |
| コンパイル使用メモリ | 6,948 KB |
| 実行使用メモリ | 17,792 KB |
| 最終ジャッジ日時 | 2024-12-17 20:37:15 |
| 合計ジャッジ時間 | 2,056 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
(define l (string->number (read-line)))
(read-line)
(define ws (sort (map string->number (string-split (read-line) " "))))
(print (let loop ((count 0) (total 0) (head (car ws)) (tail (cdr ws)))
(let* ((total+ (+ total head))
(overflow? (> total+ l)))
(cond (overflow? count)
((null? tail) (+ count 1))
(else (loop (+ count 1) total+ (car tail) (cdr tail)))))))