結果
問題 | No.302 サイコロで確率問題 (2) |
ユーザー |
![]() |
提出日時 | 2024-08-19 01:31:40 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
MLE
|
実行時間 | - |
コード長 | 699 bytes |
コンパイル時間 | 306 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 199,384 KB |
最終ジャッジ日時 | 2024-08-19 01:32:32 |
合計ジャッジ時間 | 47,867 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 MLE * 1 |
ソースコード
import sysread = sys.stdin.buffer.readreadline = sys.stdin.buffer.readlinereadlines = sys.stdin.buffer.readlinesfrom scipy.stats import normimport numpy as npN, L, R = map(int, read().split())def solve_small(N, L, R):if L > 6 * N:return 0R = min(R, 6 * N)dice = np.array([0, 1, 1, 1, 1, 1, 1], np.float64) / 6dp = 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 * Nsigma = np.sqrt(35 * N / 12)ZR = (R + 0.5 - mu) / sigmaZL = (L - 0.5 - mu) / sigmareturn norm.cdf(ZR) - norm.cdf(ZL)f = solve_small if N <= 5000 else solve_largeprint(f(N, L, R))