結果

問題 No.1049 Zero (Exhaust)
ユーザー hedwig100hedwig100
提出日時 2020-05-08 22:01:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 539 ms / 2,000 ms
コード長 258 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 83,900 KB
最終ジャッジ日時 2023-09-17 02:49:39
合計ジャッジ時間 9,490 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,516 KB
testcase_01 AC 70 ms
71,544 KB
testcase_02 AC 73 ms
71,280 KB
testcase_03 AC 381 ms
81,324 KB
testcase_04 AC 72 ms
71,440 KB
testcase_05 AC 318 ms
80,376 KB
testcase_06 AC 539 ms
83,900 KB
testcase_07 AC 123 ms
77,116 KB
testcase_08 AC 199 ms
78,316 KB
testcase_09 AC 415 ms
81,540 KB
testcase_10 AC 449 ms
82,360 KB
testcase_11 AC 446 ms
82,416 KB
testcase_12 AC 513 ms
83,444 KB
testcase_13 AC 162 ms
77,580 KB
testcase_14 AC 257 ms
79,332 KB
testcase_15 AC 387 ms
81,548 KB
testcase_16 AC 328 ms
80,480 KB
testcase_17 AC 346 ms
80,552 KB
testcase_18 AC 457 ms
82,492 KB
testcase_19 AC 394 ms
81,452 KB
testcase_20 AC 197 ms
78,188 KB
testcase_21 AC 403 ms
81,568 KB
testcase_22 AC 251 ms
79,124 KB
testcase_23 AC 535 ms
83,780 KB
testcase_24 AC 537 ms
83,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 **9 + 7
def main():
    p,K = map(int,input().split())
    dp = [0] * (K + 1)
    dp[0] = 1
    for i in range(K):
        dp[i + 1] = (p - 1)*dp[i] + 2*pow(2*p,i,MOD)
        dp[i + 1] %= MOD
    print(dp[-1])
if __name__ == '__main__':
    main()
0