30points
English:
Pompong was at home due to the impact of
the epidemic. He was bored and began to entertain himself. He thought of a game
of combining numbers. The rules of the game are as follows: Initially, there
are n numbers in a sequence, and each time Pengpeng can combine m (m ≥ 2 and m
less than or equal to the current sequence length) numbers on the left of the
sequence, that is, delete these m numbers, and the sum of these m numbers is
added to the leftmost side of the sequence, and the sum of these m numbers is
added to his own score. When the sequence length is 1 or Peng thinks he cannot
get a higher score, the game ends. Pompong’s score is initially 0. Peng Peng
asked you to help him calculate the highest score possible.
Chinese:
蓬蓬因疫情影响闲在家中,他一人无聊开始自娱自乐,想到了一个合并数字的游戏。游戏规则如下:初始共有 n 个数字排成一个序列,蓬蓬每次可以将这个序列左边的 m(m ≥ 2 且 m 小于等于当前序列长度)个数字合并,即删除这 m 个数字,然后将这 m 个数字的和加入到序列最左边,并且将这 m 个数字的和加到自己的分数上. 当序列长度为 1 或小蓬认为他无法获得更高分的时候,游戏结束。蓬蓬的分数初始为 0。蓬蓬找来聪明的你帮助他计算他能够获得的最高分是多少?
The first line of the input data is a
positive integer n, which means there are n (1 ≤ n ≤ 105) numbers in total. The
second line is n integers, and each number ci satisfies |ci| ≤ 10000.
输入数据的第一行为一个正整数 n,表示共有 n(1 ≤ n ≤ 105) 个数字。第二行为 n 个整数,每个数 ci 满足 |ci| ≤ 10000。
One line represents the highest score
that Peng Peng can get.
一行,表示蓬蓬能获得的最高分。
3
2 -1 2
4