結果

問題 No.1489 Repeat Cumulative Sum
ユーザー tktk_snsntktk_snsn
提出日時 2021-04-23 22:47:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 183 ms / 2,000 ms
コード長 260 bytes
コンパイル時間 387 ms
コンパイル使用メモリ 86,936 KB
実行使用メモリ 91,788 KB
最終ジャッジ日時 2023-09-17 12:48:33
合計ジャッジ時間 5,572 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,436 KB
testcase_01 AC 75 ms
71,388 KB
testcase_02 AC 75 ms
71,424 KB
testcase_03 AC 161 ms
88,088 KB
testcase_04 AC 154 ms
86,808 KB
testcase_05 AC 162 ms
88,048 KB
testcase_06 AC 146 ms
85,480 KB
testcase_07 AC 124 ms
81,856 KB
testcase_08 AC 107 ms
79,052 KB
testcase_09 AC 173 ms
89,924 KB
testcase_10 AC 162 ms
88,000 KB
testcase_11 AC 145 ms
85,448 KB
testcase_12 AC 85 ms
76,748 KB
testcase_13 AC 140 ms
84,196 KB
testcase_14 AC 181 ms
91,768 KB
testcase_15 AC 178 ms
91,580 KB
testcase_16 AC 130 ms
82,900 KB
testcase_17 AC 136 ms
84,032 KB
testcase_18 AC 123 ms
82,164 KB
testcase_19 AC 106 ms
78,760 KB
testcase_20 AC 118 ms
80,528 KB
testcase_21 AC 146 ms
85,416 KB
testcase_22 AC 86 ms
76,696 KB
testcase_23 AC 101 ms
77,964 KB
testcase_24 AC 76 ms
71,388 KB
testcase_25 AC 95 ms
77,056 KB
testcase_26 AC 183 ms
91,788 KB
testcase_27 AC 135 ms
84,836 KB
testcase_28 AC 85 ms
76,720 KB
testcase_29 AC 120 ms
81,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9 + 7

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.reverse()

ans = 0
cnt = M % mod
for i, a in enumerate(A, 1):
    ans += a * cnt
    ans %= mod
    cnt *= (M+i)
    cnt *= pow(i+1, mod-2, mod)
    cnt %= mod

print(ans)
0