結果
問題 | No.745 letinopia raoha |
ユーザー | tak |
提出日時 | 2019-02-04 14:37:47 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 342 ms / 2,000 ms |
コード長 | 1,751 bytes |
コンパイル時間 | 14,326 ms |
コンパイル使用メモリ | 192,648 KB |
実行使用メモリ | 34,976 KB |
最終ジャッジ日時 | 2024-06-07 12:12:43 |
合計ジャッジ時間 | 17,980 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 340 ms
34,632 KB |
testcase_01 | AC | 61 ms
29,540 KB |
testcase_02 | AC | 342 ms
34,700 KB |
testcase_03 | AC | 337 ms
34,668 KB |
testcase_04 | AC | 58 ms
29,676 KB |
testcase_05 | AC | 335 ms
34,808 KB |
testcase_06 | AC | 337 ms
34,640 KB |
testcase_07 | AC | 335 ms
34,976 KB |
testcase_08 | AC | 337 ms
34,808 KB |
testcase_09 | AC | 58 ms
29,952 KB |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (281 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/
ソースコード
type Judge = Perfect | Great | Good | Miss type Notes = { A: int; B: int; C: int; D: int } type Status = { Chain: int; Score: int; Notes: Notes } type Result = Score of int | Failed type State = Playing of Status | Finished of Result let simulateBest a b c d = let calc (chain: int) (judge: Judge): int = match judge with | Perfect -> 100 * pown 2 (chain / 100) | Great -> 50 * pown 2 (chain / 100) | _ -> 0 let update (status: Status): State = match status.Notes with | { D = 10 } -> Finished Failed // 死 | { C = 0; D = 0 } as n -> match n with | { A = 0; B = 0 } -> Finished <| Score status.Score | n when n.B > 0 -> let newChain = status.Chain + 1 let newScore = status.Score + (calc status.Chain Judge.Great) let newNotes = { n with B = n.B - 1 } Playing { Chain = newChain; Score = newScore; Notes = newNotes } | n -> let newChain = status.Chain + 1 let newScore = status.Score + (calc status.Chain Judge.Perfect) let newNotes = { n with A = n.A - 1 } Playing { Chain = newChain; Score = newScore; Notes = newNotes } | n -> Playing { status with Notes = { n with C = 0; D = 0 } } // C, Dを消費しきる let rec f (state: State): string = match state with | Finished x -> match x with | Score x -> sprintf "Possible\n%i" x | Failed -> "Impossible" | Playing s -> f <| update s f <| Playing { Chain = 0; Score = 0; Notes = { A = a; B = b; C = c; D = d } } let A, B, C, D = let t = stdin.ReadLine().Split() |> Array.map int in t.[0], t.[1], t.[2], t.[3] simulateBest A B C D |> stdout.WriteLine