結果

問題 No.1102 Remnants
ユーザー NoneNone
提出日時 2021-03-04 16:36:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 547 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 82,628 KB
実行使用メモリ 165,224 KB
最終ジャッジ日時 2024-04-15 09:00:57
合計ジャッジ時間 7,248 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,308 KB
testcase_01 AC 43 ms
55,180 KB
testcase_02 AC 46 ms
53,616 KB
testcase_03 AC 42 ms
54,184 KB
testcase_04 AC 42 ms
54,612 KB
testcase_05 AC 379 ms
129,612 KB
testcase_06 AC 110 ms
79,292 KB
testcase_07 AC 464 ms
165,224 KB
testcase_08 AC 64 ms
69,492 KB
testcase_09 AC 75 ms
71,816 KB
testcase_10 AC 56 ms
64,876 KB
testcase_11 AC 71 ms
71,376 KB
testcase_12 AC 77 ms
73,664 KB
testcase_13 AC 76 ms
71,656 KB
testcase_14 AC 235 ms
101,956 KB
testcase_15 AC 196 ms
96,312 KB
testcase_16 AC 402 ms
107,916 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 95 ms
77,932 KB
testcase_21 AC 276 ms
117,184 KB
testcase_22 AC 379 ms
122,324 KB
testcase_23 AC 300 ms
110,204 KB
testcase_24 AC 244 ms
112,520 KB
testcase_25 AC 425 ms
156,132 KB
testcase_26 AC 79 ms
73,772 KB
testcase_27 AC 158 ms
96,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #





##############################################################################################
import sys
input = sys.stdin.readline
from collections import defaultdict

MOD = 10**9+7
N,K=map(int, input().split())
A=list(map(int, input().split()))

fac=defaultdict(int)
fac[0]=1
for i in range(1,N+1):
    fac[i]=fac[i-1]*i%MOD
fac[K]=1
for i in range(K+1,K+N+1):
    fac[i]=fac[i-1]*i%MOD

def H(k,K):
    return fac[K+k-1]*pow(fac[k-1],MOD-2,MOD)%MOD

res=0
for i in range(N):
    res+=A[i]*H(i+1,K)%MOD*H(N-i,K)%MOD
    res%=MOD
print(res)
0