結果

問題 No.1049 Zero (Exhaust)
ユーザー convexineqconvexineq
提出日時 2020-05-08 21:55:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 775 ms / 2,000 ms
コード長 333 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 10,584 KB
実行使用メモリ 7,956 KB
最終ジャッジ日時 2023-09-17 02:42:18
合計ジャッジ時間 11,363 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
7,752 KB
testcase_01 AC 13 ms
7,824 KB
testcase_02 AC 13 ms
7,860 KB
testcase_03 AC 528 ms
7,832 KB
testcase_04 AC 13 ms
7,848 KB
testcase_05 AC 425 ms
7,816 KB
testcase_06 AC 729 ms
7,820 KB
testcase_07 AC 105 ms
7,756 KB
testcase_08 AC 232 ms
7,916 KB
testcase_09 AC 575 ms
7,812 KB
testcase_10 AC 616 ms
7,812 KB
testcase_11 AC 607 ms
7,784 KB
testcase_12 AC 731 ms
7,908 KB
testcase_13 AC 165 ms
7,956 KB
testcase_14 AC 330 ms
7,780 KB
testcase_15 AC 532 ms
7,812 KB
testcase_16 AC 429 ms
7,912 KB
testcase_17 AC 451 ms
7,908 KB
testcase_18 AC 633 ms
7,860 KB
testcase_19 AC 519 ms
7,868 KB
testcase_20 AC 222 ms
7,856 KB
testcase_21 AC 533 ms
7,816 KB
testcase_22 AC 313 ms
7,784 KB
testcase_23 AC 775 ms
7,904 KB
testcase_24 AC 728 ms
7,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline 
readlines = sys.stdin.readlines

p,k = [int(i) for i in read().split()]


a = 1 # zero
b = 0 # non-zero
MOD = 10**9+7

dp = [1,0,0,0,0]
for i in range(k):
    a,b = ((a+b*(p-1))+a*p+b*(p-1))%MOD, ((a+b*(p-1))+b*(p-1))%MOD
    
print(a)
0