CF158D.Ice Sculptures

普及-

通过率:0%

时间限制:3.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The Berland University is preparing to celebrate the 256-th anniversary of its founding! A specially appointed Vice Rector for the celebration prepares to decorate the campus. In the center of the campus n ice sculptures were erected. The sculptures are arranged in a circle at equal distances from each other, so they form a regular n-gon. They are numbered in clockwise order with numbers from 1 to n.

The site of the University has already conducted a voting that estimated each sculpture's characteristic of t__i — the degree of the sculpture's attractiveness. The values of t__i can be positive, negative or zero.

When the university rector came to evaluate the work, he said that this might be not the perfect arrangement. He suggested to melt some of the sculptures so that:

  • the remaining sculptures form a regular polygon (the number of vertices should be between 3 and n),
  • the sum of the t__i values of the remaining sculptures is maximized.

Help the Vice Rector to analyze the criticism — find the maximum value of t__i sum which can be obtained in this way. It is allowed not to melt any sculptures at all. The sculptures can not be moved.

贝兰德大学即将庆祝建校256周年!为此特别任命了一位庆典副校长负责校园装饰工作。校园中心竖立了 nn 座冰雕。这些冰雕等距环绕排列,构成一个正 nn 边形,并按顺时针方向依次编号为 11 至 nn。

校方此前已开展投票,对每座冰雕的“吸引力特征值” tit_i 进行了评估。tit_i 的取值可为正数、负数或零。

当校长前来视察工作时,指出当前布置可能并非最优方案,并建议融化掉其中一部分冰雕,使得:

  • 剩余冰雕仍构成一个正多边形(顶点数须在 33 到 nn 之间);
  • 剩余冰雕的 tit_i 值之和达到最大。

请协助副校长分析该意见——求出通过这种方式所能获得的最大 tit_i 值之和。允许完全不融化任何冰雕。冰雕的位置不可移动。

输入格式

The first input line contains an integer n (3 ≤ n ≤ 20000) — the initial number of sculptures. The second line contains a sequence of integers _t_1, _t_2, ..., t__n, t__i — the degree of the i-th sculpture's attractiveness ( - 1000 ≤ t__i ≤ 1000). The numbers on the line are separated by spaces.

第一行输入包含一个整数 nn(3≤n≤200003 \leq n \leq 20000)—— 初始雕塑的数量。
第二行包含一个整数序列 t1, t2, ..., tnt_1,\,t_2,\,...,\,t_n,其中 tit_i 表示第 ii 个雕塑的吸引力程度(−1000≤ti≤1000-1000 \leq t_i \leq 1000)。该行中的数字以空格分隔。

输出格式

Print the required maximum sum of the sculptures' attractiveness.

输出雕塑吸引力所需的最大总和。

输入输出样例

  • 输入#1

    8
    1 2 -3 4 -5 5 2 3

    输出#1

    14
  • 输入#2

    6
    1 -2 3 -4 5 -6

    输出#2

    9
  • 输入#3

    6
    1 2 3 4 5 6

    输出#3

    21

说明/提示

In the first sample it is best to leave every second sculpture, that is, leave sculptures with attractivenesses: 2, 4, 5 и 3.

在第一个样例中,最优策略是保留每隔一个雕塑,即保留吸引力分别为 2、4、5 和 3 的雕塑。

输入解题思路,AI测评打分。不知道怎么写?

首页