#P2512. [HAOI2008] 糖果传递
[HAOI2008] 糖果传递
Description
There are children sitting in a circle, each with candies. Each child can only pass candies to their left and right neighbors. The cost of passing one candy each time is .
Input Format
The first line contains . Each of the next lines contains .
Output Format
Output the minimum cost to make all children have the same number of candies.
4
1
2
5
4
4
Hint
Constraints: For of the testdata, , , and is a multiple of .
Translated by ChatGPT 5
京公网安备 11011102002149号