結果

問題 No.1049 Zero (Exhaust)
ユーザー 蕎麦屋蕎麦屋
提出日時 2020-05-08 21:25:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 223 ms / 2,000 ms
コード長 235 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 87,264 KB
実行使用メモリ 173,240 KB
最終ジャッジ日時 2023-09-17 01:28:45
合計ジャッジ時間 5,193 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,248 KB
testcase_01 AC 66 ms
71,288 KB
testcase_02 AC 64 ms
71,352 KB
testcase_03 AC 172 ms
138,300 KB
testcase_04 AC 69 ms
71,404 KB
testcase_05 AC 162 ms
138,372 KB
testcase_06 AC 216 ms
173,108 KB
testcase_07 AC 76 ms
84,680 KB
testcase_08 AC 111 ms
102,172 KB
testcase_09 AC 171 ms
142,016 KB
testcase_10 AC 209 ms
164,008 KB
testcase_11 AC 213 ms
164,084 KB
testcase_12 AC 223 ms
164,440 KB
testcase_13 AC 109 ms
101,020 KB
testcase_14 AC 117 ms
111,244 KB
testcase_15 AC 166 ms
141,844 KB
testcase_16 AC 168 ms
138,036 KB
testcase_17 AC 165 ms
138,276 KB
testcase_18 AC 218 ms
164,292 KB
testcase_19 AC 170 ms
142,100 KB
testcase_20 AC 105 ms
102,288 KB
testcase_21 AC 171 ms
142,020 KB
testcase_22 AC 115 ms
111,304 KB
testcase_23 AC 217 ms
173,036 KB
testcase_24 AC 223 ms
173,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

p,k = list(map(int, input().split()))

dp = [[1,0]]
MOD = 1000000007

for i in range(k):
    a = dp[-1][0]*(p+1) + dp[-1][1]*2
    b = dp[-1][0]*(p-1) + dp[-1][1]*(2*p-2)
    a %= MOD
    b %= MOD
    dp.append([a,b])

print(dp[-1][0])
0