結果

問題 No.1081 和の和
ユーザー tanon710tanon710
提出日時 2020-06-19 21:46:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 360 bytes
コンパイル時間 374 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 71,492 KB
最終ジャッジ日時 2023-09-16 13:49:56
合計ジャッジ時間 1,877 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,492 KB
testcase_01 AC 72 ms
71,476 KB
testcase_02 AC 74 ms
71,312 KB
testcase_03 AC 77 ms
71,212 KB
testcase_04 AC 73 ms
71,472 KB
testcase_05 AC 72 ms
71,336 KB
testcase_06 AC 75 ms
71,188 KB
testcase_07 AC 74 ms
71,004 KB
testcase_08 AC 74 ms
71,152 KB
testcase_09 AC 73 ms
71,000 KB
testcase_10 AC 73 ms
71,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
arr=list(map(int,input().split()))

mod=10**9+7

fact=[1]
for i in range(1,n+1):
    fact.append((fact[-1]*i)%mod)
revfact=[]
for i in range(n+1):
    revfact.append(pow(fact[i],mod-2,mod))

def comb(n,k):
    return (fact[n]*revfact[k]*revfact[n-k])%mod

ans=0
for i in range(n):
    ans+=arr[i]*comb(n-1,min(i,(n-1-i)))
    ans%=mod
print(ans)
0