結果

問題 No.797 Noelちゃんとピラミッド
ユーザー tomarint2tomarint2
提出日時 2019-03-15 22:54:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 310 ms / 2,000 ms
コード長 668 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 86,544 KB
実行使用メモリ 93,088 KB
最終ジャッジ日時 2023-09-14 14:05:57
合計ジャッジ時間 14,412 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,432 KB
testcase_01 AC 70 ms
71,316 KB
testcase_02 AC 71 ms
71,336 KB
testcase_03 AC 293 ms
92,772 KB
testcase_04 AC 295 ms
92,940 KB
testcase_05 AC 293 ms
92,844 KB
testcase_06 AC 287 ms
92,828 KB
testcase_07 AC 293 ms
92,744 KB
testcase_08 AC 290 ms
92,936 KB
testcase_09 AC 294 ms
92,752 KB
testcase_10 AC 294 ms
92,872 KB
testcase_11 AC 295 ms
93,088 KB
testcase_12 AC 300 ms
93,024 KB
testcase_13 AC 297 ms
92,940 KB
testcase_14 AC 298 ms
93,076 KB
testcase_15 AC 303 ms
93,028 KB
testcase_16 AC 308 ms
92,860 KB
testcase_17 AC 310 ms
92,740 KB
testcase_18 AC 304 ms
93,064 KB
testcase_19 AC 299 ms
92,916 KB
testcase_20 AC 300 ms
92,824 KB
testcase_21 AC 297 ms
92,844 KB
testcase_22 AC 301 ms
92,904 KB
testcase_23 AC 245 ms
87,828 KB
testcase_24 AC 150 ms
79,432 KB
testcase_25 AC 220 ms
86,336 KB
testcase_26 AC 212 ms
85,280 KB
testcase_27 AC 291 ms
92,852 KB
testcase_28 AC 270 ms
90,988 KB
testcase_29 AC 132 ms
78,288 KB
testcase_30 AC 148 ms
79,420 KB
testcase_31 AC 241 ms
88,092 KB
testcase_32 AC 166 ms
80,984 KB
testcase_33 AC 218 ms
86,228 KB
testcase_34 AC 191 ms
83,476 KB
testcase_35 AC 298 ms
92,912 KB
testcase_36 AC 127 ms
78,404 KB
testcase_37 AC 268 ms
90,944 KB
testcase_38 AC 282 ms
92,904 KB
testcase_39 AC 211 ms
86,224 KB
testcase_40 AC 125 ms
78,260 KB
testcase_41 AC 137 ms
78,764 KB
testcase_42 AC 217 ms
85,220 KB
testcase_43 AC 72 ms
71,024 KB
testcase_44 AC 72 ms
71,108 KB
testcase_45 AC 71 ms
71,344 KB
testcase_46 AC 71 ms
71,364 KB
testcase_47 AC 72 ms
71,452 KB
testcase_48 AC 71 ms
71,028 KB
testcase_49 AC 69 ms
71,152 KB
testcase_50 AC 71 ms
71,188 KB
testcase_51 AC 71 ms
70,868 KB
testcase_52 AC 72 ms
71,340 KB
testcase_53 AC 69 ms
71,320 KB
testcase_54 AC 71 ms
71,292 KB
testcase_55 AC 72 ms
71,340 KB
testcase_56 AC 71 ms
71,132 KB
testcase_57 AC 71 ms
71,300 KB
testcase_58 AC 70 ms
71,364 KB
testcase_59 AC 72 ms
71,104 KB
testcase_60 AC 72 ms
70,868 KB
testcase_61 AC 70 ms
71,364 KB
testcase_62 AC 73 ms
71,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007

def add(a, b):
    return (a + b) % mod

def sub(a, b):
    return (a + mod - b) % mod

def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y//2)**2 % mod
    else            : return power(x, y//2)**2 * x % mod

def div(a, b):
    return mul(a, power(b, mod-2))

N=int(input())
a=list(map(int,input().split()))
ans=0
b=[1 for i in range(N+1)]
for i in range(1,N//2+1):
    b[i]=div(mul(b[i-1],(N-i)),i)
for i in range(N//2):
    ans+=mul(add(a[i],a[N-1-i]),b[i])
if N%2==1:
    ans+=mul(a[N//2],b[N//2])
print(ans % mod)
0