結果

問題 No.1102 Remnants
ユーザー SSlimeSSlime
提出日時 2020-07-03 23:52:15
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 434 bytes
コンパイル時間 1,917 ms
コンパイル使用メモリ 81,364 KB
実行使用メモリ 831,224 KB
最終ジャッジ日時 2023-10-17 06:30:49
合計ジャッジ時間 3,857 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
A = list(map(int,input().split()))

mod = 10**9 + 7
l = 2*10**8
fac = [1]*l
facr = [1]*l

for i in range(l-1):
    fac[i+1] = fac[i]*(i+1)%mod
facr[l-1] = pow(fac[l-1],mod - 2,mod)
for i in range(1,l)[::-1]:
    facr[i-1] = facr[i]*i%mod

def combi(N,K):
    return fac[N]*facr[N-K]%mod*facr[K]%mod

ans = 0
for i,a in enumerate(A):
    ans += a*combi(i+1 +k -1,k)%mod*combi(n-i +k -1,k)%mod
print(ans)
0