結果

問題 No.1049 Zero (Exhaust)
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-02-11 19:29:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 87,232 KB
実行使用メモリ 93,484 KB
最終ジャッジ日時 2023-09-22 15:22:23
合計ジャッジ時間 4,362 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
73,164 KB
testcase_01 AC 106 ms
73,140 KB
testcase_02 AC 105 ms
73,052 KB
testcase_03 AC 120 ms
88,532 KB
testcase_04 AC 104 ms
72,988 KB
testcase_05 AC 121 ms
86,568 KB
testcase_06 AC 125 ms
93,260 KB
testcase_07 AC 115 ms
79,656 KB
testcase_08 AC 115 ms
82,528 KB
testcase_09 AC 121 ms
89,628 KB
testcase_10 AC 120 ms
90,444 KB
testcase_11 AC 120 ms
90,428 KB
testcase_12 AC 124 ms
92,676 KB
testcase_13 AC 114 ms
80,948 KB
testcase_14 AC 117 ms
84,592 KB
testcase_15 AC 122 ms
88,920 KB
testcase_16 AC 118 ms
86,724 KB
testcase_17 AC 119 ms
87,212 KB
testcase_18 AC 121 ms
90,636 KB
testcase_19 AC 122 ms
88,704 KB
testcase_20 AC 115 ms
82,232 KB
testcase_21 AC 123 ms
89,228 KB
testcase_22 AC 117 ms
84,280 KB
testcase_23 AC 130 ms
93,484 KB
testcase_24 AC 125 ms
93,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline

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