結果

問題 No.1102 Remnants
ユーザー ttrttr
提出日時 2020-07-03 22:22:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 933 ms / 2,000 ms
コード長 355 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 11,916 KB
実行使用メモリ 31,864 KB
最終ジャッジ日時 2023-10-17 04:31:21
合計ジャッジ時間 10,358 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,108 KB
testcase_01 AC 24 ms
10,108 KB
testcase_02 AC 25 ms
10,108 KB
testcase_03 AC 23 ms
10,108 KB
testcase_04 AC 26 ms
10,108 KB
testcase_05 AC 725 ms
27,544 KB
testcase_06 AC 138 ms
13,024 KB
testcase_07 AC 933 ms
31,864 KB
testcase_08 AC 41 ms
10,412 KB
testcase_09 AC 63 ms
10,936 KB
testcase_10 AC 29 ms
10,220 KB
testcase_11 AC 49 ms
10,676 KB
testcase_12 AC 63 ms
11,032 KB
testcase_13 AC 64 ms
10,984 KB
testcase_14 AC 432 ms
19,928 KB
testcase_15 AC 331 ms
17,000 KB
testcase_16 AC 868 ms
29,924 KB
testcase_17 AC 768 ms
26,448 KB
testcase_18 AC 785 ms
28,924 KB
testcase_19 AC 276 ms
16,472 KB
testcase_20 AC 100 ms
12,176 KB
testcase_21 AC 468 ms
21,396 KB
testcase_22 AC 666 ms
26,056 KB
testcase_23 AC 521 ms
22,336 KB
testcase_24 AC 400 ms
19,068 KB
testcase_25 AC 786 ms
29,416 KB
testcase_26 AC 67 ms
11,152 KB
testcase_27 AC 225 ms
14,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int, input().split())
A = [int(a) for a in input().split()]

mod = 10**9+7

cmb = [0]*(N+1)
cmb[0] = 1
num = 1
den = 1
for i in range(1, N+1):
    num *= (i+K)
    den *= i
    num %= mod
    den %= mod
    cmb[i] = num*pow(den, mod-2, mod)%mod



ans = 0
for i in range(N):
    ans += A[i] * cmb[i] * cmb[N-i-1] % mod
    ans %= mod

print(ans)
0