#ABC474F. 将所有约数加一 / Increment All Divisors
将所有约数加一 / Increment All Divisors
Problem Statement
You are given a length- integer sequence . You can perform the following operation on any number of times.
- Choose an integer with . For every integer that is a positive divisor of , add to .
Determine whether it is possible to make all elements of equal, and if it is possible, find the minimum number of operations required to do so.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
If it is possible to make all elements of equal, output, in one line, the minimum number of operations required to do so; otherwise, output .
3
4 7 4
3
If you choose for the first operation, you get . If you choose for the second operation, you get . If you choose for the third operation, you get . It is impossible to make all elements of equal with fewer than three operations, so the answer is .
5
1 3 4 5 6
5
2
5 2
-1
- Source: AtCoder ABC 474 F
相关
在下列比赛中: