結果

問題 No.797 Noelちゃんとピラミッド
ユーザー hogeandfugahogeandfuga
提出日時 2019-03-15 22:08:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 467 ms / 2,000 ms
コード長 360 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 10,560 KB
実行使用メモリ 20,116 KB
最終ジャッジ日時 2023-09-14 13:41:03
合計ジャッジ時間 17,516 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,880 KB
testcase_01 AC 15 ms
7,820 KB
testcase_02 AC 16 ms
7,772 KB
testcase_03 AC 467 ms
19,988 KB
testcase_04 AC 462 ms
20,036 KB
testcase_05 AC 462 ms
20,000 KB
testcase_06 AC 465 ms
20,012 KB
testcase_07 AC 458 ms
20,048 KB
testcase_08 AC 463 ms
19,968 KB
testcase_09 AC 462 ms
19,964 KB
testcase_10 AC 464 ms
19,980 KB
testcase_11 AC 462 ms
19,988 KB
testcase_12 AC 461 ms
19,956 KB
testcase_13 AC 458 ms
20,080 KB
testcase_14 AC 466 ms
20,116 KB
testcase_15 AC 464 ms
19,904 KB
testcase_16 AC 461 ms
20,072 KB
testcase_17 AC 463 ms
19,932 KB
testcase_18 AC 460 ms
20,040 KB
testcase_19 AC 459 ms
19,916 KB
testcase_20 AC 461 ms
20,040 KB
testcase_21 AC 464 ms
19,968 KB
testcase_22 AC 456 ms
19,956 KB
testcase_23 AC 332 ms
16,376 KB
testcase_24 AC 116 ms
11,500 KB
testcase_25 AC 283 ms
15,240 KB
testcase_26 AC 267 ms
14,604 KB
testcase_27 AC 448 ms
19,828 KB
testcase_28 AC 413 ms
18,396 KB
testcase_29 AC 71 ms
10,116 KB
testcase_30 AC 107 ms
10,588 KB
testcase_31 AC 336 ms
16,436 KB
testcase_32 AC 147 ms
11,548 KB
testcase_33 AC 275 ms
14,912 KB
testcase_34 AC 196 ms
13,012 KB
testcase_35 AC 459 ms
19,992 KB
testcase_36 AC 62 ms
9,344 KB
testcase_37 AC 407 ms
18,312 KB
testcase_38 AC 424 ms
18,936 KB
testcase_39 AC 269 ms
14,800 KB
testcase_40 AC 60 ms
9,272 KB
testcase_41 AC 86 ms
10,320 KB
testcase_42 AC 260 ms
14,644 KB
testcase_43 AC 16 ms
7,796 KB
testcase_44 AC 16 ms
7,832 KB
testcase_45 AC 16 ms
7,812 KB
testcase_46 AC 16 ms
7,812 KB
testcase_47 AC 15 ms
7,728 KB
testcase_48 AC 15 ms
7,828 KB
testcase_49 AC 15 ms
7,828 KB
testcase_50 AC 16 ms
7,844 KB
testcase_51 AC 16 ms
7,784 KB
testcase_52 AC 15 ms
7,888 KB
testcase_53 AC 15 ms
7,840 KB
testcase_54 AC 15 ms
7,784 KB
testcase_55 AC 16 ms
7,840 KB
testcase_56 AC 16 ms
7,896 KB
testcase_57 AC 16 ms
7,844 KB
testcase_58 AC 16 ms
7,784 KB
testcase_59 AC 15 ms
7,800 KB
testcase_60 AC 16 ms
7,892 KB
testcase_61 AC 16 ms
7,792 KB
testcase_62 AC 16 ms
7,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
x = list(map(int, input().split()))
n -= 1

mod = 10**9+7
 
#a[i] ~ i**(-1) ~ i**(mod-2) 
a = [0]*(n+1)
for i in range(1, n+1):
    a[i] = pow(i, mod-2, mod)
 
#comb[i] = nCi
comb = [0]*(n+1)
comb[0] = 1

for i in range(1, n+1):
    comb[i] = comb[i-1]*(n-i+1)*a[i]%mod

ans = 0
for i in range(n+1):
    ans += comb[i]*x[i]%mod
print(ans%mod)
0