結果
問題 | No.574 正多面体サイコロ |
ユーザー |
![]() |
提出日時 | 2025-03-26 15:43:11 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 57 ms / 2,000 ms |
コード長 | 667 bytes |
コンパイル時間 | 215 ms |
コンパイル使用メモリ | 82,120 KB |
実行使用メモリ | 67,200 KB |
最終ジャッジ日時 | 2025-03-26 15:43:21 |
合計ジャッジ時間 | 2,235 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
F, N, K = map(int, input().split()) expectation = 0.0 for v in range(1, F + 1): p = (F - v + 1) / F # Probability of getting >=v in one roll dp = [0.0] * (N + 1) dp[0] = 1.0 # Starting with 0 trials, 0 successes for i in range(1, N + 1): next_dp = [0.0] * (N + 1) for j in range(0, i + 1): if j > 0: next_dp[j] += dp[j - 1] * p if j <= i - 1: next_dp[j] += dp[j] * (1 - p) dp = next_dp # Sum probabilities where at least K successes prob = sum(dp[K:]) expectation += prob # Output with sufficient precision print("{0:.15f}".format(expectation))