結果

問題 No.1489 Repeat Cumulative Sum
ユーザー aaaaaaaaaa2230
提出日時 2021-04-23 22:51:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 278 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 82,416 KB
実行使用メモリ 91,264 KB
最終ジャッジ日時 2024-07-04 08:33:15
合計ジャッジ時間 4,157 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
A = list(map(int,input().split()))
A = A[::-1]
mod = 10**9+7

ans = 0
prod = 1
base = 1
for i in range(n-1):
    prod *= m+i
    prod %= mod
    base *= (i+1)
    base %= mod
    ans += A[i]*prod*pow(base,mod-2,mod)
    ans %= mod

print(ans)




0