#D. 糖果传递

    Type: Default 1000ms 256MiB

糖果传递

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

nn 个小朋友坐成一圈,每人有 aia_i 个糖果。每人只能给左右两人传递糖果。每人每次传递一个糖果代价为 11

输入格式

小朋友个数 nn,下面 nnaia_i

输出格式

求使所有人获得均等糖果的最小代价。

样例 #1

样例输入 #1

4
1
2
5
4

样例输出 #1

4

提示

对于 100%100\% 的数据 1n1061 \leq n\le 10^61ai1.5×1091 \leq a _ i \leq 1.5 \times 10 ^ 9

双周赛

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
4
Start at
2025-3-9 18:45
End at
2025-3-9 21:00
Duration
2.3 hour(s)
Host
Partic.
13