結果

問題 No.1049 Zero (Exhaust)
ユーザー rkyiolklorkyiolklo
提出日時 2020-05-09 01:19:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 210 ms / 2,000 ms
コード長 201 bytes
コンパイル時間 344 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 172,468 KB
最終ジャッジ日時 2023-09-17 05:32:18
合計ジャッジ時間 5,284 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,240 KB
testcase_01 AC 65 ms
70,960 KB
testcase_02 AC 62 ms
70,824 KB
testcase_03 AC 163 ms
137,640 KB
testcase_04 AC 61 ms
71,260 KB
testcase_05 AC 162 ms
137,588 KB
testcase_06 AC 209 ms
172,424 KB
testcase_07 AC 76 ms
83,928 KB
testcase_08 AC 110 ms
101,308 KB
testcase_09 AC 193 ms
163,580 KB
testcase_10 AC 201 ms
163,300 KB
testcase_11 AC 203 ms
163,348 KB
testcase_12 AC 208 ms
163,568 KB
testcase_13 AC 102 ms
100,628 KB
testcase_14 AC 114 ms
110,784 KB
testcase_15 AC 164 ms
141,272 KB
testcase_16 AC 153 ms
137,756 KB
testcase_17 AC 155 ms
137,640 KB
testcase_18 AC 198 ms
163,268 KB
testcase_19 AC 166 ms
141,768 KB
testcase_20 AC 108 ms
101,528 KB
testcase_21 AC 165 ms
141,440 KB
testcase_22 AC 116 ms
110,724 KB
testcase_23 AC 210 ms
172,284 KB
testcase_24 AC 208 ms
172,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

P,K=map(int,input().split())
mod=10**9+7
DP=[[1,0]]
for i in range(K):
  DP.append([0,0])
  DP[i+1][0]=(DP[i][0]*(P+1)+DP[i][1]*2)%mod
  DP[i+1][1]=(DP[i][0]*(P-1)+DP[i][1]*(2*P-2))%mod
print(DP[K][0])
0