結果

問題 No.1049 Zero (Exhaust)
ユーザー roarisroaris
提出日時 2020-05-08 22:55:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 571 ms / 2,000 ms
コード長 294 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 84,988 KB
最終ジャッジ日時 2023-09-17 03:20:55
合計ジャッジ時間 9,887 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
71,484 KB
testcase_01 AC 87 ms
71,784 KB
testcase_02 AC 91 ms
71,520 KB
testcase_03 AC 418 ms
82,588 KB
testcase_04 AC 90 ms
71,488 KB
testcase_05 AC 348 ms
81,540 KB
testcase_06 AC 568 ms
84,788 KB
testcase_07 AC 148 ms
78,188 KB
testcase_08 AC 222 ms
79,396 KB
testcase_09 AC 442 ms
82,976 KB
testcase_10 AC 476 ms
83,552 KB
testcase_11 AC 478 ms
83,564 KB
testcase_12 AC 535 ms
84,560 KB
testcase_13 AC 186 ms
78,748 KB
testcase_14 AC 287 ms
80,600 KB
testcase_15 AC 414 ms
82,612 KB
testcase_16 AC 350 ms
81,560 KB
testcase_17 AC 359 ms
81,668 KB
testcase_18 AC 479 ms
83,740 KB
testcase_19 AC 419 ms
82,732 KB
testcase_20 AC 217 ms
79,516 KB
testcase_21 AC 422 ms
82,780 KB
testcase_22 AC 274 ms
80,452 KB
testcase_23 AC 570 ms
84,988 KB
testcase_24 AC 571 ms
84,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

P, K = map(int, input().split())
MOD = 10**9+7
dp = [0]*(K+1)
dp[0] = 1

for i in range(1, K+1):
    dp[i] = ((P+1)*dp[i-1])%MOD
    
    if i>=2:
        dp[i] += (pow(2*P, i-1, MOD)-dp[i-1])*2
        dp[i] %= MOD

print(dp[K])
0