結果

問題 No.1102 Remnants
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-06-18 14:23:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 436 ms / 2,000 ms
コード長 341 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 82,264 KB
実行使用メモリ 134,772 KB
最終ジャッジ日時 2024-10-10 03:11:01
合計ジャッジ時間 6,806 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dic = {}
base = 1
for i in range(n+1):
    dic[(i+k,i)] = base
    base *= i+1+k
    base *= pow(i+1,mod-2,mod)
    base %= mod
    
ans = 0
for i,a in enumerate(A):
    count = dic[(i+k,i)]*dic[(n-1-i+k,n-1-i)]*a%mod
    ans += count
    ans %= mod
print(ans)
0