結果
| 問題 |
No.302 サイコロで確率問題 (2)
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-04-08 00:08:09 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
MLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 721 bytes |
| コンパイル時間 | 69 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 200,488 KB |
| 最終ジャッジ日時 | 2024-07-08 09:59:12 |
| 合計ジャッジ時間 | 50,347 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 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 <= 5000 else solve_large
print(f(N, L, R))
maspy