結果

問題 No.1102 Remnants
ユーザー brthyyjpbrthyyjp
提出日時 2021-12-15 16:35:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 336 ms / 2,000 ms
コード長 321 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 86,584 KB
実行使用メモリ 106,764 KB
最終ジャッジ日時 2023-10-01 02:30:12
合計ジャッジ時間 9,341 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 256 ms
80,668 KB
testcase_01 AC 217 ms
77,436 KB
testcase_02 AC 250 ms
80,660 KB
testcase_03 AC 252 ms
80,336 KB
testcase_04 AC 216 ms
77,120 KB
testcase_05 AC 251 ms
103,460 KB
testcase_06 AC 244 ms
84,400 KB
testcase_07 AC 336 ms
104,448 KB
testcase_08 AC 223 ms
77,892 KB
testcase_09 AC 241 ms
82,344 KB
testcase_10 AC 252 ms
80,940 KB
testcase_11 AC 257 ms
80,992 KB
testcase_12 AC 259 ms
80,876 KB
testcase_13 AC 220 ms
77,752 KB
testcase_14 AC 236 ms
89,712 KB
testcase_15 AC 253 ms
91,048 KB
testcase_16 AC 275 ms
106,764 KB
testcase_17 AC 312 ms
106,320 KB
testcase_18 AC 312 ms
101,936 KB
testcase_19 AC 272 ms
88,272 KB
testcase_20 AC 256 ms
81,604 KB
testcase_21 AC 288 ms
96,588 KB
testcase_22 AC 303 ms
104,956 KB
testcase_23 AC 288 ms
96,852 KB
testcase_24 AC 281 ms
91,400 KB
testcase_25 AC 321 ms
102,228 KB
testcase_26 AC 257 ms
81,240 KB
testcase_27 AC 266 ms
86,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

mod = 10**9+7

N = 2*10**5+50
C = [0]*N
C[0] = 1
for i in range(1, N):
    C[i] = C[i-1]*(k+i)*pow(i, mod-2, mod)
    C[i] %= mod

def cmb(i):
    return C[i]

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