結果
| 問題 | No.156 キャンディー・ボックス |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-18 19:31:02 |
| 言語 | OCaml (5.5.0) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 2,000 ms |
| + 281µs | |
| コード長 | 501 bytes |
| 記録 | |
| コンパイル時間 | 191 ms |
| コンパイル使用メモリ | 22,692 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-09-12 07:09:31 |
| 合計ジャッジ時間 | 1,952 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
コンパイルメッセージ
ocamlfind: [WARNING] Cannot read directory ./stublibs which is mentioned in ld.conf
ソースコード
let solve m c_lst =
let rec solve' rest lst result =
match lst with
| [] -> result
| x::xs ->
if rest < x then
result
else
solve' (rest - x) xs (result + 1)
in
solve' m c_lst 0
let () =
let m =
read_line ()
|> (fun l -> Scanf.sscanf l "%d %d" (fun _ m -> m))
and c_lst =
read_line ()
|> Str.split (Str.regexp_string " ")
|> List.map int_of_string
|> List.sort compare
in
solve m c_lst
|> string_of_int
|> print_endline