結果

問題 No.1049 Zero (Exhaust)
ユーザー NagisaNagisa
提出日時 2020-05-08 23:12:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 612 ms / 2,000 ms
コード長 158 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 10,612 KB
実行使用メモリ 7,964 KB
最終ジャッジ日時 2023-09-17 03:28:19
合計ジャッジ時間 9,382 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,780 KB
testcase_01 AC 13 ms
7,780 KB
testcase_02 AC 14 ms
7,852 KB
testcase_03 AC 417 ms
7,784 KB
testcase_04 AC 12 ms
7,788 KB
testcase_05 AC 342 ms
7,772 KB
testcase_06 AC 599 ms
7,804 KB
testcase_07 AC 87 ms
7,944 KB
testcase_08 AC 199 ms
7,784 KB
testcase_09 AC 463 ms
7,784 KB
testcase_10 AC 509 ms
7,932 KB
testcase_11 AC 502 ms
7,964 KB
testcase_12 AC 592 ms
7,824 KB
testcase_13 AC 138 ms
7,888 KB
testcase_14 AC 272 ms
7,796 KB
testcase_15 AC 432 ms
7,844 KB
testcase_16 AC 348 ms
7,800 KB
testcase_17 AC 356 ms
7,824 KB
testcase_18 AC 529 ms
7,884 KB
testcase_19 AC 430 ms
7,792 KB
testcase_20 AC 178 ms
7,888 KB
testcase_21 AC 456 ms
7,772 KB
testcase_22 AC 260 ms
7,928 KB
testcase_23 AC 612 ms
7,788 KB
testcase_24 AC 604 ms
7,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

P, K = map(int,input().split())
MOD = 10**9+7
z = 1
nz = 0
for k in range(K):
    z, nz = z*(P+1) + 2*nz, (z+2*nz)*(P-1)
    z %= MOD
    nz %= MOD

print(z)
0