暴力枚举
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e4+10;
int num[MAXN];
int main()
{
int n;
ios::sync_with_stdio(false);
cin >> n;
for(int i = 0; i < n; ++i)
cin >> num[i];
int res = -999999999;
//最小只能是正三角形 i <= n/3
for(int i = 1; i <= n/3; ++i)
{
//如果n%i == 0,则n可以平均分成i段,每段留下一个就是一个正i边形
if(n%i) continue;
for(int j = 0; j < i; ++j)
{
int sum = 0;
for(int k = j; k < n; k += i)
sum += num[k];
if(sum > res)
res = sum;
}
}
cout << res << endl;
}