結果

問題 No.162 8020運動
ユーザー mkawa2mkawa2
提出日時 2023-04-12 15:04:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 48 ms / 5,000 ms
コード長 1,445 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 13,056 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-17 03:38:49
合計ジャッジ時間 2,242 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,880 KB
testcase_01 AC 37 ms
10,752 KB
testcase_02 AC 40 ms
10,752 KB
testcase_03 AC 46 ms
10,752 KB
testcase_04 AC 45 ms
10,752 KB
testcase_05 AC 45 ms
10,880 KB
testcase_06 AC 44 ms
10,752 KB
testcase_07 AC 46 ms
10,880 KB
testcase_08 AC 48 ms
10,752 KB
testcase_09 AC 27 ms
10,880 KB
testcase_10 AC 43 ms
10,752 KB
testcase_11 AC 39 ms
10,880 KB
testcase_12 AC 32 ms
10,880 KB
testcase_13 AC 47 ms
10,880 KB
testcase_14 AC 28 ms
10,880 KB
testcase_15 AC 29 ms
10,880 KB
testcase_16 AC 33 ms
10,880 KB
testcase_17 AC 28 ms
10,880 KB
testcase_18 AC 44 ms
10,880 KB
testcase_19 AC 40 ms
10,880 KB
testcase_20 AC 41 ms
10,752 KB
testcase_21 AC 41 ms
10,752 KB
testcase_22 AC 42 ms
10,752 KB
testcase_23 AC 42 ms
10,880 KB
testcase_24 AC 38 ms
10,752 KB
testcase_25 AC 43 ms
10,880 KB
testcase_26 AC 28 ms
10,752 KB
testcase_27 AC 38 ms
10,880 KB
testcase_28 AC 46 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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}")
0