Submit solution
Points:
30 (partial)
Time limit:
1.0s
Memory limit:
1M
Author:
Problem type
Allowed languages
C, C++, Java, Pascal, Python
MAXDIFF
You are given a sequence of natural numbers:
,
,
,
.
The maximum value of the difference
is requested, where
and
are two terms of the sequence and
.
Input
The program reads data from the text file "maxdiff.in".
The first line contains an integer , which is the number of terms in the sequence.
The second line contains the
natural numbers
,
,
,
separated in pairs by spaces.
Ouput
The result must be printed to the text file "maxdiff.out".
Only one line should be printed containing a natural number: the maximum value of the difference , where
and
are terms of the sequence and
.
Constraints
Time limit: sec.
Maximum Available Memory: MB.
Example of Input - Output
STDIN (maxdiff.in)
10
3 12 3 0 28 9 13 4 23 7
STDOUT (maxdiff.out)
24
Comments