結果

問題 No.797 Noelちゃんとピラミッド
ユーザー takakintakakin
提出日時 2020-05-24 15:26:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 305 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 70 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 31,308 KB
最終ジャッジ日時 2024-04-19 23:51:34
合計ジャッジ時間 17,494 ms
ジャッジサーバーID
(参考情報)
judge6 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 182 ms
26,240 KB
testcase_01 AC 172 ms
26,240 KB
testcase_02 AC 173 ms
26,240 KB
testcase_03 AC 276 ms
31,176 KB
testcase_04 AC 273 ms
31,240 KB
testcase_05 AC 283 ms
31,308 KB
testcase_06 AC 305 ms
31,176 KB
testcase_07 AC 272 ms
31,048 KB
testcase_08 AC 293 ms
31,116 KB
testcase_09 AC 286 ms
31,180 KB
testcase_10 AC 297 ms
31,048 KB
testcase_11 AC 281 ms
30,992 KB
testcase_12 AC 296 ms
31,048 KB
testcase_13 AC 298 ms
31,180 KB
testcase_14 AC 277 ms
31,048 KB
testcase_15 AC 280 ms
31,048 KB
testcase_16 AC 280 ms
31,048 KB
testcase_17 AC 284 ms
31,048 KB
testcase_18 AC 276 ms
31,056 KB
testcase_19 AC 277 ms
31,048 KB
testcase_20 AC 277 ms
31,052 KB
testcase_21 AC 279 ms
31,116 KB
testcase_22 AC 278 ms
31,056 KB
testcase_23 AC 253 ms
29,720 KB
testcase_24 AC 195 ms
27,352 KB
testcase_25 AC 235 ms
29,240 KB
testcase_26 AC 232 ms
29,080 KB
testcase_27 AC 277 ms
31,052 KB
testcase_28 AC 269 ms
30,516 KB
testcase_29 AC 190 ms
26,880 KB
testcase_30 AC 196 ms
27,476 KB
testcase_31 AC 245 ms
29,796 KB
testcase_32 AC 196 ms
27,880 KB
testcase_33 AC 235 ms
29,268 KB
testcase_34 AC 219 ms
28,520 KB
testcase_35 AC 280 ms
31,172 KB
testcase_36 AC 177 ms
26,880 KB
testcase_37 AC 266 ms
30,440 KB
testcase_38 AC 280 ms
30,628 KB
testcase_39 AC 230 ms
29,288 KB
testcase_40 AC 183 ms
27,136 KB
testcase_41 AC 189 ms
27,248 KB
testcase_42 AC 239 ms
28,896 KB
testcase_43 AC 173 ms
26,368 KB
testcase_44 AC 175 ms
26,368 KB
testcase_45 AC 174 ms
26,368 KB
testcase_46 AC 172 ms
26,240 KB
testcase_47 AC 172 ms
26,368 KB
testcase_48 AC 173 ms
26,240 KB
testcase_49 AC 168 ms
26,240 KB
testcase_50 AC 177 ms
26,368 KB
testcase_51 AC 175 ms
26,496 KB
testcase_52 AC 168 ms
26,240 KB
testcase_53 AC 171 ms
26,368 KB
testcase_54 AC 167 ms
26,240 KB
testcase_55 AC 172 ms
26,240 KB
testcase_56 AC 170 ms
26,240 KB
testcase_57 AC 172 ms
26,496 KB
testcase_58 AC 174 ms
26,368 KB
testcase_59 AC 172 ms
26,368 KB
testcase_60 AC 169 ms
26,240 KB
testcase_61 AC 174 ms
26,240 KB
testcase_62 AC 172 ms
26,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
mod=10**9+7
A=[int(i) for i in input().split()]

mod=10**9+7
n_max=2*(10**5+1)
F,FI=[0]*(n_max+1),[0]*(n_max+1)
F[0],FI[0]=1,1
for i in range(n_max):
  F[i+1]=(F[i]*(i+1))%mod
FI[n_max-1]=pow(F[n_max-1],mod-2,mod)
for i in reversed(range(n_max-1)):
  FI[i]=(FI[i+1]*(i+1))%mod
def comb(x,y):
  return (F[x]*FI[x-y]*FI[y])%mod

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