結果
| 問題 |
No.1049 Zero (Exhaust)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-11 19:29:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 70 ms / 2,000 ms |
| コード長 | 362 bytes |
| コンパイル時間 | 180 ms |
| コンパイル使用メモリ | 82,132 KB |
| 実行使用メモリ | 77,440 KB |
| 最終ジャッジ日時 | 2024-07-08 06:56:37 |
| 合計ジャッジ時間 | 2,406 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
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])