結果

問題 No.1102 Remnants
ユーザー ayaoniayaoni
提出日時 2021-04-25 01:27:04
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 306 ms / 2,000 ms
コード長 695 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 112,592 KB
最終ジャッジ日時 2023-09-17 13:55:54
合計ジャッジ時間 5,904 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,336 KB
testcase_01 AC 72 ms
71,300 KB
testcase_02 AC 73 ms
71,368 KB
testcase_03 AC 72 ms
70,996 KB
testcase_04 AC 74 ms
71,412 KB
testcase_05 AC 231 ms
112,592 KB
testcase_06 AC 103 ms
79,896 KB
testcase_07 AC 306 ms
106,740 KB
testcase_08 AC 85 ms
76,556 KB
testcase_09 AC 87 ms
76,652 KB
testcase_10 AC 86 ms
76,536 KB
testcase_11 AC 89 ms
76,508 KB
testcase_12 AC 93 ms
76,480 KB
testcase_13 AC 89 ms
76,696 KB
testcase_14 AC 165 ms
93,912 KB
testcase_15 AC 146 ms
89,344 KB
testcase_16 AC 258 ms
103,636 KB
testcase_17 AC 272 ms
103,588 KB
testcase_18 AC 282 ms
103,776 KB
testcase_19 AC 151 ms
85,800 KB
testcase_20 AC 102 ms
77,832 KB
testcase_21 AC 197 ms
93,788 KB
testcase_22 AC 246 ms
101,532 KB
testcase_23 AC 208 ms
95,164 KB
testcase_24 AC 171 ms
88,820 KB
testcase_25 AC 281 ms
103,672 KB
testcase_26 AC 92 ms
76,468 KB
testcase_27 AC 134 ms
84,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


N,K = MI()
A = LI()
mod = 10**9+7

C = [1]
now = 1
for i in range(1,N):
    now *= K+i
    now *= pow(i,mod-2,mod)
    now %= mod
    C.append(now)

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

print(ans)
0