結果
問題 | No.617 Nafmo、買い出しに行く |
ユーザー | ichibanshibori |
提出日時 | 2018-09-23 04:20:09 |
言語 | F# (F# 4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,059 bytes |
コンパイル時間 | 5,758 ms |
コンパイル使用メモリ | 161,716 KB |
実行使用メモリ | 29,248 KB |
最終ジャッジ日時 | 2023-09-27 11:33:21 |
合計ジャッジ時間 | 9,388 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 88 ms
22,932 KB |
testcase_01 | WA | - |
testcase_02 | AC | 88 ms
23,044 KB |
testcase_03 | AC | 93 ms
27,032 KB |
testcase_04 | WA | - |
testcase_05 | AC | 96 ms
26,984 KB |
testcase_06 | AC | 87 ms
24,976 KB |
testcase_07 | AC | 143 ms
27,072 KB |
testcase_08 | AC | 88 ms
22,868 KB |
testcase_09 | WA | - |
testcase_10 | AC | 142 ms
29,048 KB |
testcase_11 | AC | 142 ms
29,248 KB |
testcase_12 | AC | 142 ms
27,108 KB |
testcase_13 | WA | - |
testcase_14 | AC | 143 ms
27,200 KB |
testcase_15 | AC | 86 ms
22,864 KB |
testcase_16 | WA | - |
testcase_17 | AC | 87 ms
23,072 KB |
testcase_18 | AC | 87 ms
22,900 KB |
testcase_19 | AC | 86 ms
22,948 KB |
testcase_20 | AC | 86 ms
25,136 KB |
testcase_21 | AC | 87 ms
25,068 KB |
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0 Copyright (c) Microsoft Corporation. All Rights Reserved.
ソースコード
let combination f lst = let rec combination' restLst curLst = match restLst with | [] -> () | e :: rest -> let curLst' = e :: curLst if f curLst' then combination' rest curLst' combination' rest curLst combination' lst [] exception RecursiveFinish let solve aLst k = let mutable result = 0 try combination (fun lst -> let sum = List.sum lst if sum = k then result <- k raise RecursiveFinish else if result < sum && sum < k then result <- sum sum < k) aLst with | RecursiveFinish -> () printfn "%d" result let () = let n, k = stdin.ReadLine() |> fun s -> s.Split() |> fun arr -> (int arr.[0], int arr.[1]) let aLst = seq { for _ in 1..n -> stdin.ReadLine() |> int } |> Seq.toList solve aLst k