結果
問題 |
No.162 8020運動
|
ユーザー |
![]() |
提出日時 | 2023-04-12 15:04:45 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 52 ms / 5,000 ms |
コード長 | 1,445 bytes |
コンパイル時間 | 283 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-10-08 13:36:31 |
合計ジャッジ時間 | 2,750 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
import sys sys.setrecursionlimit(200005) int1 = lambda x: int(x)-1 pDB = lambda *x: print(*x, end="\n", file=sys.stderr) p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr) def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] # dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] inf = (1 << 63)-1 # md = 10**9+7 md = 998244353 n=14 a=80-II() p0,p1,p2=LI() p0/=100 p1/=100 p2/=100 dp=[[0]*(n+1) for _ in range(a+1)] for j in range(n+1):dp[0][j]=j for y in range(1,a+1): for t in range(1,n+1): for l in range(t): pl=p2 if l==0:pl=1 if l==1:pl=p1 for r in range(l+1,t+1): pr = p2 if r == t: pr = 1 if r == t-1: pr = p1 p=pl*pr for i in range(l,r): if i==0==t-1: p*=(1-p0) elif i==0 or i==t-1: p*=(1-p1) else: p*=(1-p2) dp[y][t]+=dp[y-1][r-l]*p ans=dp[a][14]*2 print(f"{ans:.10f}")