結果

問題 No.1102 Remnants
ユーザー googol_S0googol_S0
提出日時 2020-07-03 21:51:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 978 ms / 2,000 ms
コード長 300 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 11,864 KB
実行使用メモリ 31,888 KB
最終ジャッジ日時 2023-10-17 01:20:09
合計ジャッジ時間 10,039 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,136 KB
testcase_01 AC 29 ms
10,136 KB
testcase_02 AC 29 ms
10,136 KB
testcase_03 AC 29 ms
10,136 KB
testcase_04 AC 28 ms
10,136 KB
testcase_05 AC 77 ms
27,564 KB
testcase_06 AC 150 ms
12,796 KB
testcase_07 AC 978 ms
31,888 KB
testcase_08 AC 29 ms
10,436 KB
testcase_09 AC 67 ms
10,908 KB
testcase_10 AC 34 ms
10,248 KB
testcase_11 AC 56 ms
10,712 KB
testcase_12 AC 72 ms
11,076 KB
testcase_13 AC 32 ms
10,948 KB
testcase_14 AC 57 ms
19,876 KB
testcase_15 AC 347 ms
17,020 KB
testcase_16 AC 892 ms
28,612 KB
testcase_17 AC 843 ms
26,468 KB
testcase_18 AC 845 ms
28,940 KB
testcase_19 AC 313 ms
16,492 KB
testcase_20 AC 112 ms
12,140 KB
testcase_21 AC 521 ms
21,416 KB
testcase_22 AC 734 ms
26,076 KB
testcase_23 AC 566 ms
22,348 KB
testcase_24 AC 410 ms
19,084 KB
testcase_25 AC 873 ms
29,432 KB
testcase_26 AC 75 ms
11,244 KB
testcase_27 AC 244 ms
14,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
A=list(map(int,input().split()))
if K==0:
  print(sum(A)%(10**9+7))
  exit()
X=[K]
mod=10**9+7
for i in range(N+1):
  X.append(X[-1]*pow(i+2,mod-2,mod)*(K+i+1)%mod)
P=0
for i in range(N):
  P=(P+A[i]*(1+i)*(N-i)*X[i]*X[N-i-1])%mod
print(P*pow(pow(K,mod-2,mod),2,mod)%mod)
0