結果

問題 No.813 ユキちゃんの冒険
ユーザー rookzenorookzeno
提出日時 2019-04-12 22:55:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 504 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 84,236 KB
最終ジャッジ日時 2023-08-30 13:31:50
合計ジャッジ時間 6,906 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,796 KB
testcase_01 AC 111 ms
77,548 KB
testcase_02 AC 173 ms
78,028 KB
testcase_03 AC 148 ms
78,220 KB
testcase_04 AC 402 ms
84,236 KB
testcase_05 AC 387 ms
83,344 KB
testcase_06 AC 181 ms
78,636 KB
testcase_07 AC 117 ms
77,964 KB
testcase_08 AC 286 ms
80,404 KB
testcase_09 AC 114 ms
77,672 KB
testcase_10 AC 161 ms
78,416 KB
testcase_11 AC 139 ms
78,340 KB
testcase_12 AC 303 ms
80,296 KB
testcase_13 AC 185 ms
78,592 KB
testcase_14 WA -
testcase_15 AC 366 ms
81,984 KB
testcase_16 AC 350 ms
82,412 KB
testcase_17 AC 127 ms
78,168 KB
testcase_18 AC 112 ms
77,608 KB
testcase_19 AC 482 ms
84,124 KB
testcase_20 AC 149 ms
78,196 KB
testcase_21 AC 123 ms
78,044 KB
testcase_22 AC 122 ms
77,684 KB
testcase_23 AC 195 ms
78,960 KB
testcase_24 AC 94 ms
71,660 KB
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque
sys.setrecursionlimit(20000000)
input = sys.stdin.readline
n = int(input())
p = float(input())
q = float(input())
dp = [[0,0]for i in range(n+2)]
dp[1][0] = 1
for i in range(5*n):
    dp2 = [[0,0]for i in range(n+2)]
    for j in range(n,0,-1):
        dp2[j+1][0] += dp[j][0]*q
        dp2[j-1][1] += dp[j][1]*q
        dp2[j-1][1] += dp[j][0]*p
        dp2[j+1][0] += dp[j][1]*p
    dp2[0][0] += dp[0][0]
    dp2[0][1] += dp[0][1]
    dp = dp2
print(sum(dp[0]))
0