結果

問題 No.2235 Line Up Colored Balls
ユーザー t98slider
提出日時 2023-02-22 11:02:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 281 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 82,140 KB
実行使用メモリ 79,744 KB
最終ジャッジ日時 2024-09-18 01:08:33
合計ジャッジ時間 5,477 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 55
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
x = list(map(int,input().split()))

s, s1 = 0, 0
for v in x:
    s1 += s * v
    s += v

d, div = s, 1
for i in range(30):
    if 1000000005 >> i & 1:
        div *= d
        div %= 1000000007
    d *= d
    d %= 1000000007

print((1 + 2 * s1 * div) % 1000000007)
0