結果
| 問題 |
No.32 貯金箱の憂鬱
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-09-05 09:03:16 |
| 言語 | F# (F# 4.0) |
| 結果 |
AC
|
| 実行時間 | 351 ms / 5,000 ms |
| コード長 | 523 bytes |
| コンパイル時間 | 8,767 ms |
| コンパイル使用メモリ | 191,388 KB |
| 実行使用メモリ | 35,300 KB |
| 最終ジャッジ日時 | 2024-07-23 02:08:56 |
| 合計ジャッジ時間 | 14,009 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (250 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
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)
match f [] money 0 with
| [] | [_] -> 0
| l -> l |> Seq.skip 1 |> Seq.reduce((+))
|> printfn "%d"