結果

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

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
001sample.txt AC 115 ms
53,728 KB
002sample.txt AC 117 ms
53,736 KB
003sample.txt AC 115 ms
53,732 KB
LEARGE_case1.txt AC 227 ms
75,208 KB
LEARGE_case2.txt AC 226 ms
75,216 KB
LEARGE_case3.txt AC 230 ms
75,216 KB
LEARGE_case4.txt AC 226 ms
75,212 KB
LEARGE_case5.txt AC 225 ms
75,220 KB
LEARGE_case6.txt AC 233 ms
75,216 KB
LEARGE_case7.txt AC 225 ms
75,212 KB
LEARGE_case8.txt AC 227 ms
75,212 KB
LEARGE_case9.txt AC 224 ms
75,216 KB
LEARGE_case10.txt AC 226 ms
75,212 KB
LEARGE_case11.txt AC 225 ms
75,212 KB
LEARGE_case12.txt AC 229 ms
75,212 KB
LEARGE_case13.txt AC 228 ms
75,220 KB
LEARGE_case14.txt AC 229 ms
75,212 KB
LEARGE_case15.txt AC 227 ms
75,208 KB
LEARGE_case16.txt AC 228 ms
75,220 KB
LEARGE_case17.txt AC 227 ms
75,216 KB
LEARGE_case18.txt AC 225 ms
75,224 KB
LEARGE_case19.txt AC 227 ms
75,216 KB
LEARGE_case20.txt AC 227 ms
75,212 KB
RANDOM_case1.txt AC 201 ms
69,492 KB
RANDOM_case2.txt AC 151 ms
58,844 KB
RANDOM_case3.txt AC 193 ms
67,376 KB
RANDOM_case4.txt AC 189 ms
66,352 KB
RANDOM_case5.txt AC 271 ms
74,220 KB
RANDOM_case6.txt AC 215 ms
71,636 KB
RANDOM_case7.txt AC 138 ms
56,924 KB
RANDOM_case8.txt AC 146 ms
59,056 KB
RANDOM_case9.txt AC 193 ms
69,456 KB
RANDOM_case10.txt AC 158 ms
61,628 KB
RANDOM_case11.txt AC 183 ms
66,996 KB
RANDOM_case12.txt AC 169 ms
64,064 KB
RANDOM_case13.txt AC 226 ms
75,212 KB
RANDOM_case14.txt AC 136 ms
56,056 KB
RANDOM_case15.txt AC 211 ms
71,644 KB
RANDOM_case16.txt AC 218 ms
74,216 KB
RANDOM_case17.txt AC 186 ms
67,592 KB
RANDOM_case18.txt AC 137 ms
56,152 KB
RANDOM_case19.txt AC 140 ms
57,344 KB
RANDOM_case20.txt AC 182 ms
66,208 KB
SMALL_case1.txt AC 114 ms
53,736 KB
SMALL_case2.txt AC 113 ms
53,744 KB
SMALL_case3.txt AC 116 ms
53,732 KB
SMALL_case4.txt AC 114 ms
53,740 KB
SMALL_case5.txt AC 109 ms
53,736 KB
SMALL_case6.txt AC 103 ms
53,740 KB
SMALL_case7.txt AC 102 ms
53,740 KB
SMALL_case8.txt AC 103 ms
53,740 KB
SMALL_case9.txt AC 105 ms
53,744 KB
SMALL_case10.txt AC 103 ms
53,732 KB
SMALL_case11.txt AC 103 ms
53,736 KB
SMALL_case12.txt AC 102 ms
53,740 KB
SMALL_case13.txt AC 102 ms
53,732 KB
SMALL_case14.txt AC 100 ms
53,740 KB
SMALL_case15.txt AC 102 ms
53,736 KB
SMALL_case16.txt AC 102 ms
53,732 KB
SMALL_case17.txt AC 102 ms
53,740 KB
SMALL_case18.txt AC 102 ms
53,732 KB
SMALL_case19.txt AC 101 ms
53,744 KB
SMALL_case20.txt AC 115 ms
53,736 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