結果

問題 No.162 8020運動
ユーザー convexineqconvexineq
提出日時 2020-12-12 13:04:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 81 ms / 5,000 ms
コード長 879 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 81,644 KB
実行使用メモリ 75,684 KB
最終ジャッジ日時 2023-10-20 02:06:33
合計ジャッジ時間 4,205 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
73,960 KB
testcase_01 AC 77 ms
75,672 KB
testcase_02 AC 78 ms
75,680 KB
testcase_03 AC 78 ms
75,684 KB
testcase_04 AC 81 ms
75,684 KB
testcase_05 AC 78 ms
75,680 KB
testcase_06 AC 78 ms
75,684 KB
testcase_07 AC 78 ms
75,680 KB
testcase_08 AC 78 ms
75,680 KB
testcase_09 AC 71 ms
73,960 KB
testcase_10 AC 78 ms
75,672 KB
testcase_11 AC 77 ms
75,668 KB
testcase_12 AC 76 ms
75,668 KB
testcase_13 AC 79 ms
75,684 KB
testcase_14 AC 72 ms
73,996 KB
testcase_15 AC 71 ms
73,996 KB
testcase_16 AC 77 ms
75,668 KB
testcase_17 AC 72 ms
74,032 KB
testcase_18 AC 78 ms
75,684 KB
testcase_19 AC 78 ms
75,672 KB
testcase_20 AC 76 ms
75,676 KB
testcase_21 AC 77 ms
75,676 KB
testcase_22 AC 77 ms
75,676 KB
testcase_23 AC 78 ms
75,680 KB
testcase_24 AC 80 ms
75,680 KB
testcase_25 AC 80 ms
75,676 KB
testcase_26 AC 72 ms
73,960 KB
testcase_27 AC 78 ms
75,668 KB
testcase_28 AC 80 ms
75,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a = 80 - int(input())
p0,p1,p2 = map(int,input().split())
p0 /= 100
p1 /= 100
p2 /= 100

n = 15
A = [[0.0]*n for _ in range(2)]
A[1][1] = 1.0-p0
# A[i][j] = i 本連続の歯が 1 年後に持つ j 本連続の歯の期待値
for i in range(2,n):
    r = [0.0]*n
    for mask in range(1<<i):
        p = 1.0
        for j in range(i):
            if mask>>j&1:
                p *= 1-p1 if j == 0 or j == i-1 else 1-p2  
            else:
                p *= p1 if j == 0 or j == i-1 else p2
        cnt = 0
        for j in range(i+1):
            if mask>>j&1:
                cnt += 1
            else:
                r[cnt] += p
                cnt = 0
    A.append(r)

dp = list(range(n))
for _ in range(a):
    ndp = [0.0]*n
    for i in range(n):
        v = 0.0
        for j in range(n):
            v += A[i][j]*dp[j]
        ndp[i] = v
    dp = ndp

print(dp[14]*2)
0