結果

問題 No.797 Noelちゃんとピラミッド
ユーザー brthyyjpbrthyyjp
提出日時 2020-12-14 10:30:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 484 bytes
コンパイル時間 867 ms
コンパイル使用メモリ 80,840 KB
実行使用メモリ 105,784 KB
最終ジャッジ日時 2023-10-20 04:54:30
合計ジャッジ時間 10,795 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
90,664 KB
testcase_01 AC 70 ms
90,664 KB
testcase_02 AC 70 ms
90,664 KB
testcase_03 AC 111 ms
105,444 KB
testcase_04 AC 110 ms
105,784 KB
testcase_05 AC 109 ms
105,784 KB
testcase_06 AC 109 ms
105,784 KB
testcase_07 AC 110 ms
105,784 KB
testcase_08 AC 110 ms
105,784 KB
testcase_09 AC 111 ms
105,784 KB
testcase_10 AC 110 ms
105,784 KB
testcase_11 AC 111 ms
105,784 KB
testcase_12 AC 110 ms
105,784 KB
testcase_13 AC 111 ms
105,784 KB
testcase_14 AC 111 ms
105,784 KB
testcase_15 AC 111 ms
105,784 KB
testcase_16 AC 109 ms
105,784 KB
testcase_17 AC 110 ms
105,784 KB
testcase_18 AC 110 ms
105,784 KB
testcase_19 AC 109 ms
105,784 KB
testcase_20 AC 110 ms
105,784 KB
testcase_21 AC 109 ms
105,784 KB
testcase_22 AC 110 ms
105,784 KB
testcase_23 AC 100 ms
100,676 KB
testcase_24 AC 85 ms
92,600 KB
testcase_25 AC 98 ms
98,992 KB
testcase_26 AC 96 ms
98,112 KB
testcase_27 AC 109 ms
105,712 KB
testcase_28 AC 106 ms
103,640 KB
testcase_29 AC 81 ms
91,476 KB
testcase_30 AC 83 ms
92,564 KB
testcase_31 AC 102 ms
100,664 KB
testcase_32 AC 86 ms
94,300 KB
testcase_33 AC 98 ms
98,940 KB
testcase_34 AC 92 ms
96,304 KB
testcase_35 AC 110 ms
105,784 KB
testcase_36 AC 80 ms
91,452 KB
testcase_37 AC 107 ms
103,612 KB
testcase_38 AC 109 ms
105,544 KB
testcase_39 AC 96 ms
99,092 KB
testcase_40 AC 80 ms
91,456 KB
testcase_41 AC 82 ms
91,812 KB
testcase_42 AC 95 ms
98,076 KB
testcase_43 AC 69 ms
90,668 KB
testcase_44 AC 69 ms
90,668 KB
testcase_45 AC 71 ms
90,668 KB
testcase_46 AC 69 ms
90,668 KB
testcase_47 AC 69 ms
90,664 KB
testcase_48 AC 69 ms
90,668 KB
testcase_49 AC 69 ms
90,668 KB
testcase_50 AC 69 ms
90,668 KB
testcase_51 AC 69 ms
90,668 KB
testcase_52 AC 68 ms
90,668 KB
testcase_53 AC 69 ms
90,668 KB
testcase_54 AC 69 ms
90,664 KB
testcase_55 AC 70 ms
90,668 KB
testcase_56 AC 70 ms
90,668 KB
testcase_57 AC 69 ms
90,668 KB
testcase_58 AC 69 ms
90,664 KB
testcase_59 AC 69 ms
90,668 KB
testcase_60 AC 70 ms
90,664 KB
testcase_61 AC 69 ms
90,664 KB
testcase_62 AC 69 ms
90,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))

N = 10**6
mod = 10**9+7
fac = [1]*(N+1)
finv = [1]*(N+1)
for i in range(N):
    fac[i+1] = fac[i] * (i+1) % mod
finv[-1] = pow(fac[-1], mod-2, mod)
for i in reversed(range(N)):
    finv[i] = finv[i+1] * (i+1) % mod

def cmb1(n, r, mod):
    if r <0 or r > n:
        return 0
    r = min(r, n-r)
    return fac[n] * finv[r] * finv[n-r] % mod

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