結果

問題 No.797 Noelちゃんとピラミッド
ユーザー rookzeno
提出日時 2019-03-15 22:33:11
言語 PyPy3
(6.0.0)
結果
AC  
実行時間 196 ms
コード長 439 Byte
コンパイル時間 225 ms
使用メモリ 92,196 KB
最終ジャッジ日時 2019-06-28 11:30:28

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
001sample.txt AC 89 ms
66,092 KB
002sample.txt AC 114 ms
66,104 KB
003sample.txt AC 92 ms
66,108 KB
LEARGE_case1.txt AC 192 ms
91,968 KB
LEARGE_case2.txt AC 193 ms
91,948 KB
LEARGE_case3.txt AC 194 ms
91,952 KB
LEARGE_case4.txt AC 191 ms
91,960 KB
LEARGE_case5.txt AC 192 ms
91,952 KB
LEARGE_case6.txt AC 193 ms
91,956 KB
LEARGE_case7.txt AC 191 ms
92,196 KB
LEARGE_case8.txt AC 192 ms
91,952 KB
LEARGE_case9.txt AC 193 ms
91,964 KB
LEARGE_case10.txt AC 190 ms
92,056 KB
LEARGE_case11.txt AC 192 ms
91,952 KB
LEARGE_case12.txt AC 192 ms
91,956 KB
LEARGE_case13.txt AC 196 ms
91,952 KB
LEARGE_case14.txt AC 192 ms
91,972 KB
LEARGE_case15.txt AC 192 ms
91,956 KB
LEARGE_case16.txt AC 192 ms
91,960 KB
LEARGE_case17.txt AC 194 ms
91,964 KB
LEARGE_case18.txt AC 196 ms
91,952 KB
LEARGE_case19.txt AC 193 ms
91,952 KB
LEARGE_case20.txt AC 194 ms
91,948 KB
RANDOM_case1.txt AC 165 ms
83,408 KB
RANDOM_case2.txt AC 122 ms
70,672 KB
RANDOM_case3.txt AC 158 ms
82,368 KB
RANDOM_case4.txt AC 154 ms
81,240 KB
RANDOM_case5.txt AC 189 ms
91,632 KB
RANDOM_case6.txt AC 182 ms
88,196 KB
RANDOM_case7.txt AC 117 ms
68,916 KB
RANDOM_case8.txt AC 124 ms
70,528 KB
RANDOM_case9.txt AC 170 ms
83,360 KB
RANDOM_case10.txt AC 128 ms
72,212 KB
RANDOM_case11.txt AC 160 ms
82,324 KB
RANDOM_case12.txt AC 137 ms
76,908 KB
RANDOM_case13.txt AC 193 ms
92,196 KB
RANDOM_case14.txt AC 114 ms
68,344 KB
RANDOM_case15.txt AC 182 ms
88,116 KB
RANDOM_case16.txt AC 187 ms
90,036 KB
RANDOM_case17.txt AC 157 ms
82,336 KB
RANDOM_case18.txt AC 113 ms
68,744 KB
RANDOM_case19.txt AC 118 ms
69,436 KB
RANDOM_case20.txt AC 157 ms
80,868 KB
SMALL_case1.txt AC 97 ms
66,108 KB
SMALL_case2.txt AC 97 ms
66,104 KB
SMALL_case3.txt AC 98 ms
66,104 KB
SMALL_case4.txt AC 93 ms
66,108 KB
SMALL_case5.txt AC 95 ms
66,104 KB
SMALL_case6.txt AC 93 ms
66,104 KB
SMALL_case7.txt AC 94 ms
66,108 KB
SMALL_case8.txt AC 93 ms
66,104 KB
SMALL_case9.txt AC 91 ms
66,104 KB
SMALL_case10.txt AC 94 ms
66,108 KB
SMALL_case11.txt AC 93 ms
66,100 KB
SMALL_case12.txt AC 95 ms
66,104 KB
SMALL_case13.txt AC 94 ms
66,104 KB
SMALL_case14.txt AC 92 ms
66,108 KB
SMALL_case15.txt AC 93 ms
66,104 KB
SMALL_case16.txt AC 93 ms
66,108 KB
SMALL_case17.txt AC 94 ms
66,108 KB
SMALL_case18.txt AC 93 ms
66,104 KB
SMALL_case19.txt AC 93 ms
66,108 KB
SMALL_case20.txt AC 93 ms
66,108 KB
テストケース一括ダウンロード

ソースコード

diff #
import sys
sys.setrecursionlimit(20000000)
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
fact = [1]*(n+n+1)
rfact = [1]*(n+n+1)
for i in range(n+n):
    fact[i+1] = rr = ((i+1) * fact[i]) % mod
    rfact[i+1] = pow(rr, mod-2, mod)
def comb(N, K,mod):
    return fact[N] * rfact[K] * rfact[N-K] % mod
ans = 0
for i in range(n):
        ans += comb(n-1,i,mod)*a[i]
        ans %= mod
print(ans)
0