-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA. Ciel and Dancing.cs
40 lines (36 loc) · 1 KB
/
A. Ciel and Dancing.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Numerics;
namespace ConsoleApplication25
{
class Solution
{
static void Main(string[] args)
{
var n = int.Parse(Console.ReadLine());
var init = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
int maxSum = init.Sum();
for (int i = 2; i < n / 2; i++)
{
if ( n % i == 0)
{
for (int x = 0; x < i; x++)
{
int cursum = 0;
for (int y = x; y < n; y += i)
{
cursum += init[y];
}
maxSum = Math.Max(cursum,maxSum);
}
}
}
Console.WriteLine(maxSum);
Console.ReadLine();
}
}
}