結果

問題 No.5 数字のブロック
コンテスト
ユーザー Yuzu Mashiro
提出日時 2021-04-01 17:06:24
言語 Scheme
(Gauche-0.9.15)
コンパイル:
true
実行:
gosh _filename_
結果
WA  
実行時間 -
コード長 384 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 154 ms
コンパイル使用メモリ 6,528 KB
実行使用メモリ 18,176 KB
最終ジャッジ日時 2026-05-26 23:44:34
合計ジャッジ時間 2,289 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

(define l (string->number (read-line)))
(read-line)
(define ws (sort (map string->number (string-split (read-line) " "))))

(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))))))
0