結果

問題 No.1046 Fruits Rush
ユーザー maimai8maimai8
提出日時 2020-05-11 10:44:50
言語 OCaml
(5.1.0)
結果
WA  
実行時間 -
コード長 346 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 21,576 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-17 08:54:18
合計ジャッジ時間 926 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
6,944 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
File "Main.ml", line 8, characters 4-30:
8 |     List.fast_sort compare lst;
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 10 [non-unit-statement]: this expression should have type unit.

ソースコード

diff #

open Array
let () =
    let n, k = Scanf.scanf "%d %d\n" @@ fun a b -> a, b in
    let lst = to_list (init n @@ fun _ -> Scanf.scanf "%d " @@ fun d -> d) in
    let rec f lst k = if k = 0 then 0 else match lst with
        | [] -> 0
        | h :: t -> if h > 0 then h + f t (k-1) else 0 in
    List.fast_sort compare lst;
    print_int (f lst k)
0