結果
問題 |
No.302 サイコロで確率問題 (2)
|
ユーザー |
![]() |
提出日時 | 2020-04-08 00:07:07 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 721 bytes |
コンパイル時間 | 82 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 183,100 KB |
最終ジャッジ日時 | 2024-07-08 09:55:49 |
合計ジャッジ時間 | 48,915 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 WA * 2 MLE * 1 |
ソースコード
#!/usr/bin/ python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from scipy.stats import norm import numpy as np N, L, R = map(int, read().split()) def solve_small(N, L, R): if L > 6 * N: return 0 R = min(R, 6 * N) dice = np.array([0, 1, 1, 1, 1, 1, 1], np.float64) / 6 dp = np.ones(1) for _ in range(N): dp = np.convolve(dp, dice) return dp[L: R + 1].sum() def solve_large(N, L, R): mu = 3.5 * N sigma = np.sqrt(35 * N / 12) ZR = (R + 0.5 - mu) / sigma ZL = (L - 0.5 - mu) / sigma return norm.cdf(ZR) - norm.cdf(ZL) f = solve_small if N <= 1000 else solve_large print(f(N, L, R))