Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Question by Ibrahim Mesecan.
Min of Odd Positions
Math professor of your brother has given a homework.
He has given a series of numbers. And, he is asking
the sum of (min of odd positions) and (max of even positions).
Question:
Write a program that is going to read n
numbers and show the result.
Input specification
In the first line, you will be an integer, the
number of numbers (n) where 0 ≤ n ≤ 40,000.
Then, in the following n lines, you will be
given n integers where the numbers are
between -1e8 and +1e8
Note: The number positions
goes from 1 to n.
Output specification:
Show the sum of the minimum of odd positions
and the maximum of even positions.
Sample Input I
5
14 30 17 26 85
|
Sample Output I
44
|
Explanation:
There are 3 numbers in odd positions: 14, 17 and 85 .
And, the min of odd positions is 14. The max of even positions is 30. So,
the sum is 44.
Для отправки решений необходимо выполнить вход.
|