結果

問題 No.797 Noelちゃんとピラミッド
ユーザー hedwig100hedwig100
提出日時 2020-04-24 21:14:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 204 ms / 2,000 ms
コード長 841 bytes
コンパイル時間 319 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 29,996 KB
最終ジャッジ日時 2024-04-23 02:45:17
合計ジャッジ時間 12,306 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
18,816 KB
testcase_01 AC 112 ms
18,816 KB
testcase_02 AC 111 ms
18,944 KB
testcase_03 AC 195 ms
29,876 KB
testcase_04 AC 198 ms
29,748 KB
testcase_05 AC 190 ms
29,876 KB
testcase_06 AC 191 ms
29,748 KB
testcase_07 AC 188 ms
29,744 KB
testcase_08 AC 191 ms
29,860 KB
testcase_09 AC 185 ms
29,996 KB
testcase_10 AC 183 ms
29,744 KB
testcase_11 AC 186 ms
29,748 KB
testcase_12 AC 204 ms
29,876 KB
testcase_13 AC 198 ms
29,744 KB
testcase_14 AC 193 ms
29,744 KB
testcase_15 AC 195 ms
29,740 KB
testcase_16 AC 190 ms
29,748 KB
testcase_17 AC 196 ms
29,868 KB
testcase_18 AC 195 ms
29,872 KB
testcase_19 AC 188 ms
29,748 KB
testcase_20 AC 190 ms
29,872 KB
testcase_21 AC 193 ms
29,880 KB
testcase_22 AC 198 ms
29,792 KB
testcase_23 AC 171 ms
26,544 KB
testcase_24 AC 124 ms
21,172 KB
testcase_25 AC 162 ms
25,472 KB
testcase_26 AC 158 ms
24,844 KB
testcase_27 AC 197 ms
29,440 KB
testcase_28 AC 186 ms
28,336 KB
testcase_29 AC 118 ms
20,096 KB
testcase_30 AC 125 ms
20,928 KB
testcase_31 AC 166 ms
26,508 KB
testcase_32 AC 133 ms
22,096 KB
testcase_33 AC 159 ms
25,336 KB
testcase_34 AC 147 ms
23,244 KB
testcase_35 AC 193 ms
29,688 KB
testcase_36 AC 119 ms
19,968 KB
testcase_37 AC 188 ms
28,292 KB
testcase_38 AC 187 ms
28,708 KB
testcase_39 AC 156 ms
24,912 KB
testcase_40 AC 121 ms
19,840 KB
testcase_41 AC 133 ms
20,452 KB
testcase_42 AC 156 ms
24,732 KB
testcase_43 AC 113 ms
18,944 KB
testcase_44 AC 106 ms
18,944 KB
testcase_45 AC 105 ms
18,816 KB
testcase_46 AC 115 ms
18,816 KB
testcase_47 AC 112 ms
18,944 KB
testcase_48 AC 111 ms
18,944 KB
testcase_49 AC 113 ms
18,816 KB
testcase_50 AC 117 ms
18,816 KB
testcase_51 AC 109 ms
18,816 KB
testcase_52 AC 115 ms
18,816 KB
testcase_53 AC 109 ms
18,944 KB
testcase_54 AC 109 ms
18,944 KB
testcase_55 AC 116 ms
18,944 KB
testcase_56 AC 104 ms
18,944 KB
testcase_57 AC 108 ms
18,944 KB
testcase_58 AC 120 ms
18,944 KB
testcase_59 AC 105 ms
18,944 KB
testcase_60 AC 116 ms
18,944 KB
testcase_61 AC 108 ms
18,816 KB
testcase_62 AC 110 ms
18,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

INF = 10 ** 9
MOD = 10 **9 + 7
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)
from  collections import deque
from math import factorial

MAXN = 100005
factorial = [1]
for i in range(1, MAXN + 1):
    factorial.append(factorial[-1] * i % MOD)

inv_factorial = [-1] * (MAXN + 1)
inv_factorial[-1] = pow(factorial[-1], MOD-2, MOD)
for i in reversed(range(MAXN)):
    inv_factorial[i] = inv_factorial[i + 1] * (i + 1) % MOD

def fact(n):
    return factorial[n]

def nck(n, k):
    if k>n or k<0:
        return 0
    else:
        return factorial[n] * inv_factorial[n-k] * inv_factorial[k] % MOD

def main():
    n = int(input())
    a = list(map(int,input().split()))
    
    ans = 0
    for i in range(n):
        ans += nck(n - 1,i) * a[i]
        ans %= MOD
    print(ans)
if __name__=='__main__':
    main()
0