結果

問題 No.1049 Zero (Exhaust)
ユーザー googol_S0googol_S0
提出日時 2020-05-08 22:52:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 215 ms / 2,000 ms
コード長 201 bytes
コンパイル時間 1,012 ms
コンパイル使用メモリ 86,840 KB
実行使用メモリ 172,756 KB
最終ジャッジ日時 2023-09-17 03:20:04
合計ジャッジ時間 5,572 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
71,264 KB
testcase_01 AC 61 ms
71,172 KB
testcase_02 AC 59 ms
71,132 KB
testcase_03 AC 159 ms
137,864 KB
testcase_04 AC 59 ms
71,088 KB
testcase_05 AC 152 ms
138,020 KB
testcase_06 AC 213 ms
172,748 KB
testcase_07 AC 74 ms
84,392 KB
testcase_08 AC 103 ms
101,764 KB
testcase_09 AC 197 ms
163,624 KB
testcase_10 AC 201 ms
163,512 KB
testcase_11 AC 199 ms
163,792 KB
testcase_12 AC 203 ms
164,092 KB
testcase_13 AC 96 ms
100,764 KB
testcase_14 AC 111 ms
110,884 KB
testcase_15 AC 164 ms
141,780 KB
testcase_16 AC 154 ms
137,920 KB
testcase_17 AC 157 ms
138,140 KB
testcase_18 AC 199 ms
163,620 KB
testcase_19 AC 165 ms
142,072 KB
testcase_20 AC 107 ms
101,880 KB
testcase_21 AC 163 ms
141,656 KB
testcase_22 AC 116 ms
110,976 KB
testcase_23 AC 215 ms
172,736 KB
testcase_24 AC 208 ms
172,756 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