cswork / OA打开练习工作台

其他OA #10

Maximum Adjacent Gap

简单可在线判题

考点(AI 标注)原地数组

Find the maximum absolute difference between adjacent elements in input order. The source's examples and constraints are explicit; this site adds the standard input protocol.

输入格式

The first line contains n (1≤n≤1000), and the second line contains n integers in the range −100000..100000.

输出格式

Output the maximum absolute difference between adjacent elements of the original array; for a single-element array, output 0.

样例 1

输入:

4
3 8 2 10

输出:

8

样例 2

输入:

1
7

输出:

0

样例 3

输入:

4
-4 -10 6 1

输出:

16