結果

問題 No.1015 おつりは要らないです
ユーザー ikdikd
提出日時 2020-05-03 12:05:00
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 897 bytes
コンパイル時間 6,571 ms
コンパイル使用メモリ 168,364 KB
実行使用メモリ 43,836 KB
最終ジャッジ日時 2023-09-02 11:45:58
合計ジャッジ時間 12,326 ms
ジャッジサーバーID
(参考情報)
judge16 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
24,512 KB
testcase_01 AC 73 ms
20,428 KB
testcase_02 AC 72 ms
24,644 KB
testcase_03 AC 73 ms
22,612 KB
testcase_04 AC 73 ms
22,504 KB
testcase_05 AC 74 ms
22,684 KB
testcase_06 AC 74 ms
22,552 KB
testcase_07 AC 75 ms
22,628 KB
testcase_08 AC 74 ms
22,484 KB
testcase_09 AC 75 ms
24,508 KB
testcase_10 AC 254 ms
41,536 KB
testcase_11 AC 258 ms
43,700 KB
testcase_12 AC 248 ms
42,924 KB
testcase_13 AC 255 ms
41,384 KB
testcase_14 AC 268 ms
42,060 KB
testcase_15 AC 250 ms
40,988 KB
testcase_16 AC 254 ms
43,464 KB
testcase_17 AC 259 ms
43,836 KB
testcase_18 AC 254 ms
43,284 KB
testcase_19 AC 255 ms
43,292 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 73 ms
22,532 KB
testcase_31 AC 181 ms
35,492 KB
testcase_32 AC 180 ms
37,360 KB
testcase_33 AC 249 ms
42,492 KB
testcase_34 AC 74 ms
22,644 KB
testcase_35 AC 72 ms
24,568 KB
testcase_36 AC 73 ms
24,584 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

/home/judge/data/code/Main.fs(25,9): warning FS0025: Incomplete pattern matches on this expression. For example, the value '[|_; _; _; _; _|]' may indicate a case not covered by the pattern(s).

ソースコード

diff #

// Learn more about F# at http://fsharp.org

open System

// v 円の紙幣 x 枚
let solve v x a =
    let b, x2 =
        a
        |> Array.sortDescending
        |> Array.mapFold (fun rest p ->
            (if rest <= 0 || p <= v then
                p, rest
             else
                 let k = Math.Min(rest, p / v)
                 p - k * v, rest - k)) x
    b
    |> Array.sortDescending
    |> Array.mapFold (fun rest p ->
        (if rest <= 0 then p, rest else p - v, rest - 1)) x2
    |> fst
    |> Array.filter (fun p -> p >= 0)

[<EntryPoint>]
let main argv =
    let [| n; x; y; z |] = stdin.ReadLine().Split() |> Array.map int

    let a = stdin.ReadLine().Split() |> Array.map int

    let b = a |> solve 10000 z
    let c = b |> solve 5000 y
    let d = c |> solve 1000 x
    if d |> Array.isEmpty then printfn "Yes" else printfn "No"
    0 // return an integer exit code
0