結果
問題 | No.32 貯金箱の憂鬱 |
ユーザー | regerege |
提出日時 | 2015-09-05 08:50:10 |
言語 | F# (F# 4.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 488 bytes |
コンパイル時間 | 5,979 ms |
コンパイル使用メモリ | 157,260 KB |
実行使用メモリ | 27,564 KB |
最終ジャッジ日時 | 2023-09-26 08:44:26 |
合計ジャッジ時間 | 7,160 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 90 ms
23,188 KB |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | AC | 88 ms
23,096 KB |
testcase_04 | AC | 89 ms
23,036 KB |
testcase_05 | AC | 87 ms
23,096 KB |
testcase_06 | AC | 89 ms
23,280 KB |
testcase_07 | AC | 89 ms
21,104 KB |
testcase_08 | AC | 92 ms
25,136 KB |
testcase_09 | RE | - |
testcase_10 | AC | 89 ms
25,140 KB |
testcase_11 | AC | 88 ms
23,272 KB |
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0 Copyright (c) Microsoft Corporation. All Rights Reserved.
ソースコード
let L = int <| stdin.ReadLine() let M = int <| stdin.ReadLine() let N = int <| stdin.ReadLine() let money = Seq.zip [100;25;1;] [L;M;N] |> Seq.map (fun (a,b) -> a*b) |> Seq.reduce ((+)) let coins = [1000;100;25;1;] let rec f l m p = let a,b = m/coins.[p],m%coins.[p] if m - a*coins.[p] = 0 then l@[a] else f (l@[a]) (m-a*coins.[p]) (p+1) f [] money 0 |> Seq.skip 1 |> Seq.reduce((+)) |> printfn "%d"