結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,456 ms
167,168 KB
testcase_01 AC 1,442 ms
167,296 KB
testcase_02 AC 1,440 ms
167,296 KB
testcase_03 AC 1,519 ms
172,108 KB
testcase_04 AC 1,517 ms
171,852 KB
testcase_05 AC 1,536 ms
172,048 KB
testcase_06 AC 1,490 ms
171,848 KB
testcase_07 AC 1,657 ms
171,856 KB
testcase_08 AC 1,572 ms
172,112 KB
testcase_09 AC 1,516 ms
172,108 KB
testcase_10 AC 1,542 ms
172,104 KB
testcase_11 AC 1,763 ms
172,108 KB
testcase_12 AC 1,531 ms
171,984 KB
testcase_13 AC 1,563 ms
171,976 KB
testcase_14 AC 1,507 ms
171,984 KB
testcase_15 AC 1,514 ms
171,788 KB
testcase_16 AC 1,504 ms
171,980 KB
testcase_17 AC 1,599 ms
171,792 KB
testcase_18 AC 1,581 ms
171,988 KB
testcase_19 AC 1,571 ms
171,784 KB
testcase_20 AC 1,609 ms
171,852 KB
testcase_21 AC 1,557 ms
172,104 KB
testcase_22 AC 1,781 ms
172,112 KB
testcase_23 AC 1,517 ms
170,516 KB
testcase_24 AC 1,508 ms
168,404 KB
testcase_25 AC 1,521 ms
170,172 KB
testcase_26 AC 1,497 ms
170,004 KB
testcase_27 AC 1,563 ms
171,724 KB
testcase_28 AC 1,487 ms
171,312 KB
testcase_29 AC 1,621 ms
167,936 KB
testcase_30 AC 1,629 ms
168,316 KB
testcase_31 AC 1,460 ms
170,844 KB
testcase_32 AC 1,478 ms
168,812 KB
testcase_33 AC 1,521 ms
170,096 KB
testcase_34 AC 1,474 ms
169,320 KB
testcase_35 AC 1,543 ms
171,784 KB
testcase_36 AC 1,487 ms
167,680 KB
testcase_37 AC 1,550 ms
171,496 KB
testcase_38 AC 1,557 ms
171,712 KB
testcase_39 AC 1,475 ms
170,120 KB
testcase_40 AC 1,454 ms
167,808 KB
testcase_41 AC 1,453 ms
168,180 KB
testcase_42 AC 1,497 ms
170,000 KB
testcase_43 AC 1,452 ms
167,424 KB
testcase_44 AC 1,410 ms
167,396 KB
testcase_45 AC 1,458 ms
167,168 KB
testcase_46 AC 1,415 ms
167,040 KB
testcase_47 AC 1,454 ms
167,296 KB
testcase_48 AC 1,405 ms
167,040 KB
testcase_49 AC 1,424 ms
167,296 KB
testcase_50 AC 1,440 ms
167,424 KB
testcase_51 AC 1,467 ms
167,424 KB
testcase_52 AC 1,382 ms
167,424 KB
testcase_53 AC 1,491 ms
167,168 KB
testcase_54 AC 1,404 ms
167,424 KB
testcase_55 AC 1,457 ms
167,424 KB
testcase_56 AC 1,636 ms
167,168 KB
testcase_57 AC 1,423 ms
167,168 KB
testcase_58 AC 1,423 ms
167,168 KB
testcase_59 AC 1,449 ms
167,424 KB
testcase_60 AC 1,417 ms
167,424 KB
testcase_61 AC 1,589 ms
167,424 KB
testcase_62 AC 1,437 ms
167,168 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**6+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