結果

問題 No.1049 Zero (Exhaust)
ユーザー brthyyjpbrthyyjp
提出日時 2020-05-08 22:24:07
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 296 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 848,480 KB
最終ジャッジ日時 2023-09-17 03:06:20
合計ジャッジ時間 3,149 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,496 KB
testcase_01 AC 70 ms
71,368 KB
testcase_02 AC 69 ms
71,424 KB
testcase_03 MLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

p, k = map(int, input().split())
mod = 10**9+7

dp = [[0]*2 for _ in range(k+1)]
dp[0][0] = 1
dp[0][1] = 0

for i in range(k):
    dp[i+1][0] = (p+1)*dp[i][0]+2*dp[i][1]
    dp[i+1][1] = (p-1)*dp[i][0]+2*(p-1)*dp[i][1]
    #dp[i+1][0] %= mod
    #dp[i+1][1] %= mod
#print(dp)
print(dp[k][0]%mod)
0