結果

問題 No.5 数字のブロック
ユーザー MOD9cXWdOsRxvPyMOD9cXWdOsRxvPy
提出日時 2022-10-30 23:15:04
言語 Scheme
(Gauche-0.9.15)
結果
AC  
実行時間 49 ms / 5,000 ms
コード長 428 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 17,792 KB
最終ジャッジ日時 2024-07-07 14:21:15
合計ジャッジ時間 2,542 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env gosh

(define (how-meny l ws)
  (let loop ([i 1][sum (car ws)][wr (cdr ws)])
    (cond
     ((> sum l) (- i 1))
     ((null? wr) i)
     (else (loop (+ i 1) (+ sum (car wr)) (cdr wr))))
    )
  )

(define (main _)
  (let* ([l (read)])
    (read)(read-char)
    (let ([ws (sort
	       (map (^x (string->number x))
		    (string-split (read-line) " ")))])
      (display (how-meny l ws))
      ))
  (newline)
  0)
0