附上有道的翻译
Berland大学正准备庆祝成立256周年!副校长任命的特别庆典准备装修。在校园的中心n冰雕被竖立起来的。雕塑被安排在一个圆在彼此相等的距离,所以他们组建一个正则n角。他们以顺时针顺序编号数字从1到n。
大学的网站已经进行了投票,估计每个雕塑的特点ti -雕塑的程度的吸引力。ti的值可以是正数、负数或零。
当大学校长来评估工作,他说,这可能不是完美的安排。他建议融化一些雕塑,以便:
剩下的雕塑形成一个正多边形(顶点的数量应该是3至n),
ti值之和的雕塑是最大化。
帮助分析批评的副校长——找到ti之和的最大值可以通过这种方式获得的。它允许不融化任何雕塑。这些雕塑不能移动。
#include<iostream>
#include<cstdio>
#include<map>
#include<cstring>
#include<string>
using namespace std;
int array[20002];
int n;
int solve()
{
int len;
int maxn = -20000000;
for(len = 1;len<n;len++)
{
if(n%len==0&&n/len>=3)
{
int b[20002]={0};
for(int j = 0;j<n;j++)
b[j%len]+=array[j];
for(int j=0;j<len;j++)
maxn = max(maxn,b[j]);
}
}
return maxn;
}
int main()
{
cin >> n;
for(int i=0;i<n;i++)
cin >> array[i];
cout<<solve()<<endl;
return 0;
}