結果

問題 No.1102 Remnants
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-20 15:35:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 259 ms / 2,000 ms
コード長 325 bytes
コンパイル時間 839 ms
コンパイル使用メモリ 81,512 KB
実行使用メモリ 105,044 KB
最終ジャッジ日時 2023-10-21 10:46:09
合計ジャッジ時間 6,350 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,108 KB
testcase_01 AC 37 ms
53,108 KB
testcase_02 AC 36 ms
53,108 KB
testcase_03 AC 37 ms
53,108 KB
testcase_04 AC 36 ms
53,108 KB
testcase_05 AC 185 ms
98,032 KB
testcase_06 AC 66 ms
68,652 KB
testcase_07 AC 259 ms
101,492 KB
testcase_08 AC 46 ms
63,924 KB
testcase_09 AC 49 ms
63,908 KB
testcase_10 AC 42 ms
61,852 KB
testcase_11 AC 50 ms
65,980 KB
testcase_12 AC 55 ms
68,028 KB
testcase_13 AC 49 ms
63,904 KB
testcase_14 AC 120 ms
83,548 KB
testcase_15 AC 101 ms
78,024 KB
testcase_16 AC 208 ms
103,152 KB
testcase_17 AC 220 ms
102,680 KB
testcase_18 AC 219 ms
104,944 KB
testcase_19 AC 108 ms
84,068 KB
testcase_20 AC 64 ms
70,944 KB
testcase_21 AC 159 ms
92,448 KB
testcase_22 AC 199 ms
100,900 KB
testcase_23 AC 160 ms
92,752 KB
testcase_24 AC 130 ms
86,724 KB
testcase_25 AC 230 ms
105,044 KB
testcase_26 AC 56 ms
65,960 KB
testcase_27 AC 97 ms
81,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

L = [1] * (N + 1)
for i in range(1, N + 1):
    L[i] = L[i - 1] * (K + i) * pow(i, mod - 2, mod) % mod
R = L[::-1]


ans = 0
for i, a in enumerate(A):
    ans += a * L[i] * R[i + 1] % mod
    if ans >= mod:
        ans -= mod

print(ans)
0