結果

問題 No.1049 Zero (Exhaust)
ユーザー rlangevinrlangevin
提出日時 2023-02-01 01:16:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 267 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 87,224 KB
実行使用メモリ 76,104 KB
最終ジャッジ日時 2023-09-13 16:05:34
合計ジャッジ時間 3,752 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,300 KB
testcase_01 AC 69 ms
71,388 KB
testcase_02 AC 72 ms
71,324 KB
testcase_03 AC 84 ms
75,820 KB
testcase_04 AC 76 ms
71,612 KB
testcase_05 AC 80 ms
75,976 KB
testcase_06 AC 85 ms
75,900 KB
testcase_07 AC 77 ms
76,104 KB
testcase_08 AC 78 ms
76,096 KB
testcase_09 AC 83 ms
75,848 KB
testcase_10 AC 82 ms
75,904 KB
testcase_11 AC 84 ms
75,900 KB
testcase_12 AC 86 ms
76,020 KB
testcase_13 AC 78 ms
76,020 KB
testcase_14 AC 80 ms
76,104 KB
testcase_15 AC 84 ms
75,816 KB
testcase_16 AC 81 ms
76,096 KB
testcase_17 AC 81 ms
76,036 KB
testcase_18 AC 84 ms
75,876 KB
testcase_19 AC 82 ms
76,104 KB
testcase_20 AC 78 ms
75,972 KB
testcase_21 AC 84 ms
75,828 KB
testcase_22 AC 79 ms
75,992 KB
testcase_23 AC 88 ms
75,812 KB
testcase_24 AC 85 ms
76,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

P, K = map(int, input().split())
mod = 10 ** 9 + 7
pre0, pre1 = 1, 0
for i in range(K):
    dp0 = (P + 1) * pre0 + 2 * pre1
    dp1 = (P - 1) * pre0 + (2 * P - 2) * pre1
    dp0 %= mod
    dp1 %= mod
    dp0, pre0 = pre0, dp0
    dp1, pre1 = pre1, dp1
print(pre0)    
0