結果

問題 No.1049 Zero (Exhaust)
ユーザー ddnneddnne
提出日時 2020-05-09 15:16:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 845 ms / 2,000 ms
コード長 217 bytes
コンパイル時間 607 ms
コンパイル使用メモリ 10,744 KB
実行使用メモリ 7,984 KB
最終ジャッジ日時 2023-09-19 07:08:29
合計ジャッジ時間 13,117 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,796 KB
testcase_01 AC 16 ms
7,716 KB
testcase_02 AC 15 ms
7,796 KB
testcase_03 AC 522 ms
7,784 KB
testcase_04 AC 15 ms
7,912 KB
testcase_05 AC 446 ms
7,960 KB
testcase_06 AC 806 ms
7,984 KB
testcase_07 AC 114 ms
7,784 KB
testcase_08 AC 249 ms
7,832 KB
testcase_09 AC 581 ms
7,788 KB
testcase_10 AC 664 ms
7,824 KB
testcase_11 AC 679 ms
7,916 KB
testcase_12 AC 785 ms
7,776 KB
testcase_13 AC 182 ms
7,856 KB
testcase_14 AC 342 ms
7,796 KB
testcase_15 AC 541 ms
7,716 KB
testcase_16 AC 485 ms
7,784 KB
testcase_17 AC 460 ms
7,716 KB
testcase_18 AC 694 ms
7,924 KB
testcase_19 AC 579 ms
7,856 KB
testcase_20 AC 247 ms
7,916 KB
testcase_21 AC 626 ms
7,788 KB
testcase_22 AC 333 ms
7,852 KB
testcase_23 AC 801 ms
7,912 KB
testcase_24 AC 845 ms
7,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# D

P, K = list(map(int, input().split()))
mod = 10**9 + 7

z_i, n_i = 1, 0
for i in range(K):
    z_i, n_i = (P + 1) * z_i + 2 * n_i, (P - 1) * z_i + 2 * (P - 1) * n_i
    z_i, n_i = z_i % mod, n_i % mod

print(z_i)
0