#d1402. 最大公约数
最大公约数
Greatest Common Divisor
Problem Description
You have a ring with positive integers on it. You may cut the ring into segments, each containing one or more numbers.
For a cutting scheme, its "beauty" is defined as the greatest common divisor of the sums of the numbers in each segment. You want to maximize the beauty of the cutting scheme. For , output the answer.
Input Format
The first line contains an integer , the number of numbers on the ring.
The next line contains positive integers; the -th number is the -th number on the ring.
Output Format
Output lines; the -th line is the maximum beauty when cut into segments.
Sample Input
7
2 3 3 3 3 3 3
Sample Output
20
5
2
2
1
1
1
Constraints
There are 10 test cases in total.
Test cases satisfy .
Test cases satisfy .
For all data: , .
Hint
See the attached file.