結果

問題 No.797 Noelちゃんとピラミッド
ユーザー 💕💖💞💕💖💞
提出日時 2019-05-11 19:44:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 461 ms / 2,000 ms
コード長 479 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 10,736 KB
実行使用メモリ 19,968 KB
最終ジャッジ日時 2023-09-14 18:15:41
合計ジャッジ時間 17,138 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,780 KB
testcase_01 AC 16 ms
7,944 KB
testcase_02 AC 16 ms
7,908 KB
testcase_03 AC 455 ms
19,824 KB
testcase_04 AC 454 ms
19,728 KB
testcase_05 AC 455 ms
19,856 KB
testcase_06 AC 454 ms
19,788 KB
testcase_07 AC 456 ms
19,824 KB
testcase_08 AC 452 ms
19,836 KB
testcase_09 AC 458 ms
19,764 KB
testcase_10 AC 458 ms
19,760 KB
testcase_11 AC 454 ms
19,788 KB
testcase_12 AC 458 ms
19,868 KB
testcase_13 AC 459 ms
19,724 KB
testcase_14 AC 459 ms
19,832 KB
testcase_15 AC 456 ms
19,752 KB
testcase_16 AC 458 ms
19,728 KB
testcase_17 AC 461 ms
19,768 KB
testcase_18 AC 454 ms
19,836 KB
testcase_19 AC 452 ms
19,968 KB
testcase_20 AC 457 ms
19,768 KB
testcase_21 AC 454 ms
19,920 KB
testcase_22 AC 454 ms
19,856 KB
testcase_23 AC 329 ms
16,456 KB
testcase_24 AC 112 ms
11,280 KB
testcase_25 AC 277 ms
15,200 KB
testcase_26 AC 263 ms
14,612 KB
testcase_27 AC 448 ms
19,576 KB
testcase_28 AC 405 ms
18,632 KB
testcase_29 AC 71 ms
10,476 KB
testcase_30 AC 105 ms
10,376 KB
testcase_31 AC 324 ms
16,372 KB
testcase_32 AC 143 ms
11,560 KB
testcase_33 AC 270 ms
14,880 KB
testcase_34 AC 193 ms
12,924 KB
testcase_35 AC 450 ms
19,756 KB
testcase_36 AC 60 ms
9,408 KB
testcase_37 AC 398 ms
18,496 KB
testcase_38 AC 417 ms
18,912 KB
testcase_39 AC 267 ms
14,840 KB
testcase_40 AC 61 ms
9,456 KB
testcase_41 AC 85 ms
10,320 KB
testcase_42 AC 256 ms
14,560 KB
testcase_43 AC 16 ms
7,860 KB
testcase_44 AC 16 ms
7,856 KB
testcase_45 AC 16 ms
7,840 KB
testcase_46 AC 16 ms
7,812 KB
testcase_47 AC 16 ms
7,844 KB
testcase_48 AC 16 ms
7,788 KB
testcase_49 AC 16 ms
7,784 KB
testcase_50 AC 15 ms
7,780 KB
testcase_51 AC 16 ms
8,004 KB
testcase_52 AC 16 ms
7,776 KB
testcase_53 AC 16 ms
7,820 KB
testcase_54 AC 16 ms
7,852 KB
testcase_55 AC 16 ms
7,768 KB
testcase_56 AC 17 ms
7,876 KB
testcase_57 AC 16 ms
7,860 KB
testcase_58 AC 16 ms
7,804 KB
testcase_59 AC 16 ms
7,824 KB
testcase_60 AC 16 ms
7,828 KB
testcase_61 AC 16 ms
7,772 KB
testcase_62 AC 16 ms
7,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7
def cmb_gen(n):
    fac = [0] * n
    inv = [0] * n
    fac[0] = fac[1] = 1
    inv[0] = inv[1] = 1
    for i in range(2, n):
        fac[i] = (fac[i - 1] * i) % MOD
        inv[i] = pow(fac[i], MOD - 2, MOD)

    def cmb_mod(n, r):
        return (fac[n] * inv[n - r] * inv[r]) % MOD

    return cmb_mod

N = int(input())
xs = list(map(int, input().split()))
cmb_mod = cmb_gen(N)
r = 0
for i in range(N):
    r += xs[i] * cmb_mod(N-1, i)
    r %= MOD

print(r)
0