結果

問題 No.162 8020運動
ユーザー yaoshimaxyaoshimax
提出日時 2015-03-06 00:10:32
言語 PyPy2
(7.3.13)
結果
AC  
実行時間 281 ms / 5,000 ms
コード長 1,077 bytes
コンパイル時間 1,380 ms
コンパイル使用メモリ 77,464 KB
実行使用メモリ 80,468 KB
最終ジャッジ日時 2023-09-06 15:21:52
合計ジャッジ時間 8,225 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
79,012 KB
testcase_01 AC 212 ms
79,792 KB
testcase_02 AC 234 ms
79,868 KB
testcase_03 AC 275 ms
80,308 KB
testcase_04 AC 280 ms
80,392 KB
testcase_05 AC 280 ms
80,228 KB
testcase_06 AC 279 ms
80,468 KB
testcase_07 AC 281 ms
80,248 KB
testcase_08 AC 279 ms
80,288 KB
testcase_09 AC 92 ms
78,832 KB
testcase_10 AC 236 ms
80,132 KB
testcase_11 AC 187 ms
79,532 KB
testcase_12 AC 145 ms
79,516 KB
testcase_13 AC 280 ms
80,440 KB
testcase_14 AC 113 ms
79,200 KB
testcase_15 AC 115 ms
79,364 KB
testcase_16 AC 159 ms
79,356 KB
testcase_17 AC 122 ms
79,292 KB
testcase_18 AC 277 ms
80,268 KB
testcase_19 AC 222 ms
79,920 KB
testcase_20 AC 244 ms
79,800 KB
testcase_21 AC 239 ms
80,068 KB
testcase_22 AC 239 ms
79,936 KB
testcase_23 AC 240 ms
79,948 KB
testcase_24 AC 232 ms
79,920 KB
testcase_25 AC 249 ms
79,980 KB
testcase_26 AC 91 ms
78,952 KB
testcase_27 AC 192 ms
79,620 KB
testcase_28 AC 279 ms
80,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

A=int(raw_input())
P0,P1,P2=map(int,raw_input().split())
dp=[[-1.0 for i in range(15)] for j in range(20)]

def rec(age, n):
    #print age-A,n
    if age == 80:
        return n
    elif n==0:
        return 0
    elif dp[age-A][n] >=0:
        return dp[age-A][n]
    elif n==1:
        dp[age-A][n]=rec(age+1,1)*(100-P0)/100.0
        return dp[age-A][n]
    ans = 0
    for m in range(1<<n):
        eLen = 0.0
        prob = 1.0
        nextN=0
        for l in range(n):
            if m&(1<<l)==0:
                if l == 0 or l == n-1:
                    prob *= P1/100.0
                else:
                    prob *= P2/100.0
                if nextN>0:
                    eLen += rec(age+1,nextN)
                    nextN=0
            else:
                if l==0 or l==n-1:
                    prob *= (100-P1)/100.0
                else:
                    prob *= (100-P2)/100.0
                nextN+=1
        if nextN>0:
            eLen += rec(age+1,nextN)
        ans += eLen*prob
    dp[age-A][n]=ans
    return dp[age-A][n]

print rec(A,14)*2




0