CT919

Ivo's Ledger of tickets

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Ivo the dispatch writer watches over the cotton rows of Whitewick's stores of tickets. A careful computation stands between order and chaos. 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 <= 33; -1000000 <= a[i] <= 10; answers fit a signed 64-bit integer.

Example 1:

Input: 9 -93200 -954541 -642454 -21874 -19726 -91151 -400712 -659488 -327580
Output: 861341

Example 2:

Input: 29 -621137 -910741 -101577 -624582 -540585 -530416 -94799 -753045 -157243 -142719 -619837 -113886 -822671 -164275 -682137 -367845 -817273 -818357 -599812 -662365 -663512 -722724 -672664 -955171 -661828 -770476 -784109 -971957 -767285
Output: 809164

Example 3:

Input: 15 -376066 -51489 -527752 -105176 -158528 -322173 -791131 -89284 -678839 -997031 -566009 -164277 -996314 -718566 -750793
Output: 832037

Constraints:

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

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