結果
問題 | No.5 数字のブロック |
ユーザー |
|
提出日時 | 2020-06-16 01:01:53 |
言語 | OCaml (5.2.1) |
結果 |
AC
|
実行時間 | 7 ms / 5,000 ms |
コード長 | 314 bytes |
コンパイル時間 | 265 ms |
コンパイル使用メモリ | 21,580 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-09 01:20:16 |
合計ジャッジ時間 | 1,627 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
Scanf.scanf "%d %d" (fun l n -> let w = Array.init n (fun _ -> Scanf.scanf " %d" (fun w -> w)) in Array.sort compare w; let rec loop i sum = if i = n then i else if sum + w.(i) <= l then loop (i + 1) (sum + w.(i)) else i in loop 0 0 |> Printf.printf "%d\n" )