|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|1 초||256 MB||7||5||1||33.333%|
Let x1 < x2 < … < xn be positive integers and let x1 and x2 be relatively prime (i.e. the only positive integer that evenly divides both of them is 1).
We consider all infinite sequences of integers, which are strictly increasing with first member 0, for which the difference between any two adjacent members is equal to one of the integers x1, x2, …, xn. For example, if n = 2, x1 = 4 and x2 = 7, then the first nine members of such a sequence are possible to be 0, 4, 8, 15, 19, 26, 33, 40, 44.
Write program sequence that determines the largest integer that cannot be found in any of these sequences.
The integer n (1 < n < 6) is given on the first line of the standard input. There are n integers on the second line: x1, x2, …, xn.
On a line of the standard output the program have to write the sought integer.
1 < n < 6, x1 > 1, xn < 1000
n = 2, x1 > 1, xn < 109
1 < n < 6, 1 < x1 < 106-n, x2 > 10n+11, xn < 10n+12
2 4 7