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
def main():
    n = int(input())
    a = list(map(int,input().split()))

    d = 0
    for i in a:
        d += i
    for i in range(n,0,-1):
        if i == 1:
            print(1)
            break
        if d % i == 0:
            t = False
            end = [0] * n
            active = 0
            for j in range(n):
                if a[j] - active < 0:
                    t = True
                    break

                if a[j] - active > 0:
                    if j + i-1  >= n:
                        t = True
                        break
                    end[j+i-1] += a[j] - active

                active += a[j] - active
                active -= end[j]
            if not t:
                print(i)
                break








main()