結果

問題 No.1102 Remnants
ユーザー AEnAEn
提出日時 2022-11-24 10:58:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 273 ms / 2,000 ms
コード長 377 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 81,840 KB
実行使用メモリ 105,520 KB
最終ジャッジ日時 2023-10-26 02:27:04
合計ジャッジ時間 6,397 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,588 KB
testcase_01 AC 38 ms
53,588 KB
testcase_02 AC 38 ms
53,588 KB
testcase_03 AC 39 ms
53,588 KB
testcase_04 AC 38 ms
53,588 KB
testcase_05 AC 226 ms
103,444 KB
testcase_06 AC 77 ms
75,376 KB
testcase_07 AC 273 ms
102,076 KB
testcase_08 AC 54 ms
64,504 KB
testcase_09 AC 59 ms
66,552 KB
testcase_10 AC 50 ms
62,436 KB
testcase_11 AC 57 ms
66,552 KB
testcase_12 AC 61 ms
68,600 KB
testcase_13 AC 61 ms
68,604 KB
testcase_14 AC 149 ms
88,856 KB
testcase_15 AC 129 ms
85,532 KB
testcase_16 AC 251 ms
105,048 KB
testcase_17 AC 237 ms
104,840 KB
testcase_18 AC 240 ms
105,420 KB
testcase_19 AC 117 ms
84,648 KB
testcase_20 AC 68 ms
71,516 KB
testcase_21 AC 164 ms
93,816 KB
testcase_22 AC 213 ms
102,796 KB
testcase_23 AC 174 ms
94,384 KB
testcase_24 AC 139 ms
88,092 KB
testcase_25 AC 243 ms
105,520 KB
testcase_26 AC 58 ms
68,580 KB
testcase_27 AC 101 ms
82,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
A = list(map(int,input().split()))

mod = 10**9+7
inv = [0]*(N+1)
inv[0] = 1
for i in range(1,N):
    inv[i] = (inv[i-1]*pow(i,mod-2,mod))%mod
comb = [0]*N
comb[0] = 1
for i in range(1,N):
    comb[i] = (comb[i-1]*(K+i))%mod

res = 0
for i in range(1,N+1):
    res += (A[i-1]*comb[i-1]*inv[i-1]*comb[N-i]*inv[N-i])%mod
    res %= mod
print(res)
0