結果

問題 No.813 ユキちゃんの冒険
ユーザー KentarokumuraKentarokumura
提出日時 2019-04-13 00:59:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 388 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 77,476 KB
最終ジャッジ日時 2023-08-30 13:52:39
合計ジャッジ時間 4,670 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,212 KB
testcase_01 AC 85 ms
76,736 KB
testcase_02 AC 99 ms
77,184 KB
testcase_03 AC 99 ms
77,404 KB
testcase_04 AC 132 ms
77,140 KB
testcase_05 AC 136 ms
77,336 KB
testcase_06 AC 109 ms
77,288 KB
testcase_07 AC 89 ms
76,544 KB
testcase_08 AC 188 ms
77,128 KB
testcase_09 AC 87 ms
76,684 KB
testcase_10 AC 104 ms
77,396 KB
testcase_11 AC 99 ms
77,076 KB
testcase_12 AC 152 ms
77,124 KB
testcase_13 AC 110 ms
77,076 KB
testcase_14 AC 86 ms
76,684 KB
testcase_15 AC 187 ms
77,216 KB
testcase_16 AC 126 ms
77,136 KB
testcase_17 AC 93 ms
77,132 KB
testcase_18 AC 87 ms
76,780 KB
testcase_19 AC 195 ms
77,068 KB
testcase_20 AC 99 ms
77,180 KB
testcase_21 AC 91 ms
77,296 KB
testcase_22 AC 92 ms
77,144 KB
testcase_23 AC 238 ms
77,252 KB
testcase_24 AC 88 ms
76,704 KB
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
N=int(input())
q=float(input())
p=float(input())
if N==1:
    print(q)
    sys.exit()
dp=[0.0]*N
dp1=[0.0]*N
dp[0]=1
ans=0
for k in range(5000):
    ndp=[0.0]*N
    ndp1=[0.0]*N
    for i in range(1,N):
        ndp[i]=p*dp[i-1]+q*dp1[i]
    ndp1[N-1]=q*dp[N-1]
    for i in range(N-2,-1,-1):
        ndp1[i]=p*dp1[i+1]+q*dp[i]
    dp=ndp
    dp1=ndp1
    ans+=dp1[0]
print(ans)
0