Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Question by Ibrahim Mesecan.
Derivative of an array
In math, derivative is the change between states.
In image processing, when calculating the derivative
of a series of numbers previous number is subtracted
from this number. And the result is written into
this position.
Question:
Write a program that reads an array,
and then calculates the the biggest
change in the new array.
Input specification
In the first line, you will be given one integer:
array length (n). Then, in the following n lines
you will be given n integers where each number is
between -2e4 and 2e4 and 0 ≤ n ≤ 30,000.
Output specification:
Show one integer: the biggest change in
the derivative of the array.
Note: Assume that you have zero (0)
before the first number.
Sample Input I
5
15
52
75
34
40
|
Sample Output I
41
|
Explanation:
The difference array contains (difference
between ai and ai-1)
: 15, 37, 23, 41, 6 .
So, the biggest change is 41 .
Для отправки решений необходимо выполнить вход.
|