CT1151

Zigzag ingots Largest Step

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Before the gates of the ferry landing of Crosswater close for winter, Nandini must finish the ingots ledger - one figure at a time. 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 <= 91; -100 <= a[i] <= 1000000000; answers fit a signed 64-bit integer.

Example 1:

Input: 53 867840550 432686691 311206056 451742965 534083100 59784222 20818634 163647636 583366778 958259232 298449156 418777460 813711462 73899836 363812969 973006888 10889504 732236554 93927342 713304692 291450303 572901806 894550018 502482456 535234358 57459897 310828762 333887317 937535403 997782857 536728192 663294239 587309654 698341325 819690015 802671225 865823959 770228248 415829152 990246584 467499319 225997672 503788268 960693689 320873826 177349363 401499556 689740997 225652120 222697657 871303836 194229981 317872938
Output: 962117384

Example 2:

Input: 1 292372211
Output: 0

Example 3:

Input: 64 909085969 786322547 646182996 393301850 941281592 288924304 239926124 510621023 668970467 592631336 144563459 62072777 461586917 40810981 598357344 917684963 427011279 741514072 485053249 251278205 878661585 988266977 335542668 365923401 756213190 712917072 410197451 576227897 857530071 811257171 949385303 378994555 433231633 274692361 942988857 951579758 410142272 658128118 721717347 94937317 897537153 197560412 416441820 102830785 852435418 279479808 882053044 479489661 99672645 154606301 934853236 680755954 406794619 273713818 81650086 541874135 472671342 772981362 234878162 231559234 203109999 863457209 427946585 222908232
Output: 802599836

Constraints:

1 <= n <= 91; -100 <= a[i] <= 1000000000; answers fit a signed 64-bit integer.

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