結果

問題 No.1049 Zero (Exhaust)
ユーザー mkawa2mkawa2
提出日時 2020-05-09 16:40:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 493 ms / 2,000 ms
コード長 909 bytes
コンパイル時間 896 ms
コンパイル使用メモリ 10,804 KB
実行使用メモリ 47,812 KB
最終ジャッジ日時 2023-09-19 09:29:57
合計ジャッジ時間 8,621 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
8,576 KB
testcase_01 AC 21 ms
8,688 KB
testcase_02 AC 21 ms
8,600 KB
testcase_03 AC 337 ms
35,072 KB
testcase_04 AC 20 ms
8,680 KB
testcase_05 AC 277 ms
30,136 KB
testcase_06 AC 482 ms
47,800 KB
testcase_07 AC 79 ms
13,356 KB
testcase_08 AC 157 ms
19,916 KB
testcase_09 AC 372 ms
37,876 KB
testcase_10 AC 402 ms
40,484 KB
testcase_11 AC 401 ms
40,652 KB
testcase_12 AC 463 ms
45,624 KB
testcase_13 AC 119 ms
16,756 KB
testcase_14 AC 221 ms
25,232 KB
testcase_15 AC 348 ms
35,900 KB
testcase_16 AC 284 ms
30,536 KB
testcase_17 AC 294 ms
31,444 KB
testcase_18 AC 414 ms
41,240 KB
testcase_19 AC 352 ms
35,948 KB
testcase_20 AC 155 ms
19,628 KB
testcase_21 AC 363 ms
36,672 KB
testcase_22 AC 209 ms
24,340 KB
testcase_23 AC 493 ms
47,812 KB
testcase_24 AC 487 ms
47,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import *
from bisect import *
from collections import *
from heapq import *
import sys

sys.setrecursionlimit(10 ** 6)

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def SI(): return sys.stdin.readline()[:-1]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
int1 = lambda x: int(x) - 1
def MI1(): return map(int1, sys.stdin.readline().split())
def LI1(): return list(map(int1, sys.stdin.readline().split()))
p2D = lambda x: print(*x, sep="\n")
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

def main():
    md=10**9+7
    p,k=MI()
    dp=[0]*(k+1)
    dp[0]=1
    tot=1
    for i in range(k):
        dp[i+1]=dp[i]*(p+1)+(tot-dp[i])*2
        dp[i+1]%=md
        tot=tot*2*p%md
    print(dp[k])

main()
0