結果

問題 No.813 ユキちゃんの冒険
ユーザー KentarokumuraKentarokumura
提出日時 2019-04-12 23:09:03
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 388 bytes
コンパイル時間 1,452 ms
コンパイル使用メモリ 86,912 KB
実行使用メモリ 77,372 KB
最終ジャッジ日時 2023-08-30 13:33:47
合計ジャッジ時間 4,022 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,412 KB
testcase_01 AC 83 ms
76,580 KB
testcase_02 AC 89 ms
76,540 KB
testcase_03 AC 84 ms
76,732 KB
testcase_04 AC 92 ms
77,024 KB
testcase_05 AC 93 ms
76,884 KB
testcase_06 AC 85 ms
76,792 KB
testcase_07 AC 85 ms
76,900 KB
testcase_08 AC 91 ms
76,596 KB
testcase_09 AC 84 ms
76,516 KB
testcase_10 AC 89 ms
76,656 KB
testcase_11 AC 87 ms
76,700 KB
testcase_12 AC 88 ms
76,868 KB
testcase_13 AC 87 ms
76,536 KB
testcase_14 AC 81 ms
76,580 KB
testcase_15 AC 92 ms
77,372 KB
testcase_16 AC 94 ms
77,016 KB
testcase_17 AC 85 ms
76,732 KB
testcase_18 AC 86 ms
76,660 KB
testcase_19 AC 93 ms
77,216 KB
testcase_20 AC 87 ms
76,792 KB
testcase_21 AC 83 ms
76,788 KB
testcase_22 AC 85 ms
76,568 KB
testcase_23 AC 84 ms
76,600 KB
testcase_24 AC 85 ms
76,744 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(1000):
    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