結果

問題 No.797 Noelちゃんとピラミッド
ユーザー 👑 rin204rin204
提出日時 2020-08-18 11:27:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 211 ms / 2,000 ms
コード長 570 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 29,640 KB
最終ジャッジ日時 2024-04-20 07:27:08
合計ジャッジ時間 9,662 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,752 KB
testcase_01 AC 28 ms
10,880 KB
testcase_02 AC 27 ms
10,752 KB
testcase_03 AC 207 ms
29,516 KB
testcase_04 AC 198 ms
29,524 KB
testcase_05 AC 203 ms
29,512 KB
testcase_06 AC 204 ms
29,388 KB
testcase_07 AC 201 ms
29,388 KB
testcase_08 AC 201 ms
29,384 KB
testcase_09 AC 211 ms
29,512 KB
testcase_10 AC 209 ms
29,516 KB
testcase_11 AC 201 ms
29,388 KB
testcase_12 AC 203 ms
29,392 KB
testcase_13 AC 201 ms
29,516 KB
testcase_14 AC 198 ms
29,516 KB
testcase_15 AC 197 ms
29,512 KB
testcase_16 AC 201 ms
29,508 KB
testcase_17 AC 200 ms
29,516 KB
testcase_18 AC 199 ms
29,388 KB
testcase_19 AC 201 ms
29,640 KB
testcase_20 AC 198 ms
29,516 KB
testcase_21 AC 205 ms
29,388 KB
testcase_22 AC 202 ms
29,516 KB
testcase_23 AC 154 ms
24,128 KB
testcase_24 AC 63 ms
14,868 KB
testcase_25 AC 133 ms
22,068 KB
testcase_26 AC 125 ms
21,264 KB
testcase_27 AC 190 ms
29,024 KB
testcase_28 AC 179 ms
27,084 KB
testcase_29 AC 47 ms
13,056 KB
testcase_30 AC 61 ms
14,644 KB
testcase_31 AC 146 ms
23,952 KB
testcase_32 AC 75 ms
16,252 KB
testcase_33 AC 124 ms
21,688 KB
testcase_34 AC 96 ms
18,324 KB
testcase_35 AC 196 ms
29,376 KB
testcase_36 AC 43 ms
12,672 KB
testcase_37 AC 190 ms
27,116 KB
testcase_38 AC 198 ms
28,016 KB
testcase_39 AC 127 ms
21,412 KB
testcase_40 AC 43 ms
12,672 KB
testcase_41 AC 55 ms
13,556 KB
testcase_42 AC 128 ms
21,084 KB
testcase_43 AC 26 ms
10,752 KB
testcase_44 AC 25 ms
10,752 KB
testcase_45 AC 24 ms
10,752 KB
testcase_46 AC 24 ms
10,752 KB
testcase_47 AC 25 ms
10,752 KB
testcase_48 AC 26 ms
10,752 KB
testcase_49 AC 26 ms
10,624 KB
testcase_50 AC 26 ms
10,752 KB
testcase_51 AC 25 ms
10,752 KB
testcase_52 AC 25 ms
10,880 KB
testcase_53 AC 24 ms
10,752 KB
testcase_54 AC 24 ms
10,752 KB
testcase_55 AC 26 ms
10,752 KB
testcase_56 AC 25 ms
10,752 KB
testcase_57 AC 24 ms
10,752 KB
testcase_58 AC 24 ms
10,880 KB
testcase_59 AC 24 ms
10,752 KB
testcase_60 AC 24 ms
10,752 KB
testcase_61 AC 24 ms
10,752 KB
testcase_62 AC 25 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
MOD = 10 ** 9 + 7
N = n + 10
fact = [0 for _ in range(N)]
invfact = [0 for _ in range(N)]
fact[0] = 1
for i in range(1, N):
    fact[i] = fact[i - 1] * i % MOD

invfact[N - 1] = pow(fact[N - 1], MOD - 2, MOD)

for i in range(N - 2, -1, -1):
    invfact[i] = invfact[i + 1] * (i + 1) % MOD
def nCk(n, k):
    if k < 0 or n < k:
        return 0
    else:
        return fact[n] * invfact[k] * invfact[n - k] % MOD
        
alst = list(map(int, input().split()))
ans = 0

for i, a in enumerate(alst):
    ans += a * nCk(n - 1, i)
    ans %= MOD
print(ans)
0