結果

問題 No.1489 Repeat Cumulative Sum
ユーザー tktk_snsn
提出日時 2021-04-23 22:47:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 260 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 82,224 KB
実行使用メモリ 90,756 KB
最終ジャッジ日時 2024-07-04 08:29:43
合計ジャッジ時間 4,004 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

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