結果

問題 No.2235 Line Up Colored Balls
ユーザー shobonvip
提出日時 2023-03-03 21:40:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 217 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 81,536 KB
実行使用メモリ 80,256 KB
最終ジャッジ日時 2024-09-18 01:09:22
合計ジャッジ時間 5,273 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 55
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9 + 7
n = int(input())
x = list(map(int,input().split()))
r = sum(x)
ans = 0
for i in range(n):
	ans += x[i] * (r-x[i]) % mod
	ans %= mod

ans *= pow(r, mod-2, mod)
ans %= mod
ans += 1
ans %= mod

print(ans)
0