結果

問題 No.797 Noelちゃんとピラミッド
ユーザー rlangevinrlangevin
提出日時 2023-01-30 00:17:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 527 bytes
コンパイル時間 466 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 101,288 KB
最終ジャッジ日時 2023-09-12 06:06:23
合計ジャッジ時間 11,865 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
83,960 KB
testcase_01 AC 86 ms
83,888 KB
testcase_02 AC 86 ms
83,796 KB
testcase_03 AC 134 ms
101,200 KB
testcase_04 AC 123 ms
101,140 KB
testcase_05 AC 123 ms
101,268 KB
testcase_06 AC 123 ms
101,088 KB
testcase_07 AC 123 ms
101,224 KB
testcase_08 AC 123 ms
101,204 KB
testcase_09 AC 122 ms
101,248 KB
testcase_10 AC 123 ms
101,088 KB
testcase_11 AC 123 ms
100,988 KB
testcase_12 AC 123 ms
101,164 KB
testcase_13 AC 123 ms
101,240 KB
testcase_14 AC 121 ms
101,140 KB
testcase_15 AC 123 ms
101,284 KB
testcase_16 AC 125 ms
101,236 KB
testcase_17 AC 125 ms
101,044 KB
testcase_18 AC 123 ms
101,196 KB
testcase_19 AC 122 ms
101,180 KB
testcase_20 AC 122 ms
101,200 KB
testcase_21 AC 123 ms
101,280 KB
testcase_22 AC 125 ms
101,288 KB
testcase_23 AC 111 ms
95,424 KB
testcase_24 AC 97 ms
86,280 KB
testcase_25 AC 108 ms
93,868 KB
testcase_26 AC 108 ms
92,752 KB
testcase_27 AC 123 ms
101,012 KB
testcase_28 AC 118 ms
98,932 KB
testcase_29 AC 94 ms
84,556 KB
testcase_30 AC 96 ms
86,136 KB
testcase_31 AC 112 ms
95,388 KB
testcase_32 AC 98 ms
87,908 KB
testcase_33 AC 109 ms
93,700 KB
testcase_34 AC 103 ms
90,804 KB
testcase_35 AC 123 ms
101,160 KB
testcase_36 AC 92 ms
84,416 KB
testcase_37 AC 118 ms
99,088 KB
testcase_38 AC 127 ms
100,728 KB
testcase_39 AC 109 ms
93,640 KB
testcase_40 AC 92 ms
84,596 KB
testcase_41 AC 94 ms
85,092 KB
testcase_42 AC 107 ms
92,568 KB
testcase_43 AC 86 ms
84,048 KB
testcase_44 AC 86 ms
83,904 KB
testcase_45 AC 87 ms
83,888 KB
testcase_46 AC 94 ms
83,828 KB
testcase_47 AC 87 ms
84,048 KB
testcase_48 AC 87 ms
83,916 KB
testcase_49 AC 86 ms
83,680 KB
testcase_50 AC 85 ms
83,864 KB
testcase_51 AC 86 ms
83,912 KB
testcase_52 AC 86 ms
83,828 KB
testcase_53 AC 87 ms
83,888 KB
testcase_54 AC 86 ms
83,960 KB
testcase_55 AC 86 ms
83,992 KB
testcase_56 AC 86 ms
83,684 KB
testcase_57 AC 85 ms
83,848 KB
testcase_58 AC 86 ms
83,904 KB
testcase_59 AC 87 ms
83,828 KB
testcase_60 AC 85 ms
83,964 KB
testcase_61 AC 86 ms
84,068 KB
testcase_62 AC 86 ms
84,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
mod = 10 ** 9 + 7

n = 505050

fact = [1] * (n + 1)
invfact = [1] * (n + 1)
for i in range(1, n):
    fact[i + 1] = ((i+1) * fact[i]) % mod
invfact[n] = pow(fact[n], mod - 2, mod)
for i in range(n - 1, -1, -1):
    invfact[i] = invfact[i + 1] * (i + 1) % mod

def comb(n, r):
    if n < 0 or r < 0 or n - r < 0:
        return 0
    return fact[n] * invfact[r] * invfact[n - r] % mod

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