CT1465

The Largest Step of Verdigris

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Every season at the copper works of Verdigris, someone must track down a clerical error. This year the task falls to Gino, armed only with the crates register. Task: Read n integers and print the largest absolute difference between two consecutive elements. For n=1 print 0. Input format: First line: n. Second line: n space-separated integers. Output format: Print the maximum consecutive absolute difference. Constraints: 1 <= n <= 56; 0 <= a[i] <= 10; answers fit a signed 64-bit integer.

Example 1:

Input: 29 2 5 9 8 3 7 0 4 8 2 10 0 10 6 3 2 8 3 4 4 8 1 4 9 9 9 0 7 1
Output: 10

Example 2:

Input: 6 0 6 1 1 3 7
Output: 6

Example 3:

Input: 36 2 4 6 3 6 2 3 7 2 0 0 8 4 3 6 6 7 10 4 2 9 8 9 0 0 1 3 10 3 2 6 4 10 2 10 2
Output: 9

Constraints:

1 <= n <= 56; 0 <= a[i] <= 10; answers fit a signed 64-bit integer.

Loading...
Test Cases:No test cases
No test cases available.