CT27528

Last ingots of Elowen

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Morning light hits the copper works of Verdigris as Elowen unrolls the day's manifest of ingots. The tally will decide the next shipment. 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 <= 294; -1000000 <= a[i] <= 1000; answers fit a signed 64-bit integer.

Example 1:

Input: 214 -251474 -679952 -251250 -924883 -507059 -465184 -848554 -480747 -291223 -510539 -467595 -310409 -623894 -578600 -810553 -933038 -20928 -249658 -115060 -390761 -435394 -864188 -54443 -809815 -167796 -158160 -167506 -403161 -322745 -85683 -530397 -593609 -524899 -25265 -422741 -803191 -302520 -360452 -187408 -848272 -770198 -157250 -972694 -562601 -962889 -483979 -210065 -206892 -275492 -406038 -300173 -559659 -895644 -937831 -31922 -132530 -326111 -558643 -126152 -871014 -188258 -942716 -829250 -434917 -840154 -12626 -496795 -75062 -361278 -317408 -567800 -409940 -47667 -208923 -685642 -426040 -961562 -279596 -828078 -708205 -425287 -500204 -16757 -264162 -234288 -130478 -388078 -175672 -989427 -21636 -938420 -734724 -810133 -617061 -509229 -3417 -587787 -518406 -228893 -767239 -897136 …
Output: 967791

Example 2:

Input: 233 -640890 -358627 -168265 -523766 -782737 -771979 -828466 -898687 -773969 -358224 -733631 -407958 -560011 -159703 -224296 -692783 -354796 -596900 -245857 -210382 -304524 -429009 -657335 -627756 -651190 -582799 -135285 -113603 -40483 -412109 -172496 -121520 -69744 -806527 -844686 -966283 -601316 -490990 -240075 -553868 -455966 -291639 -862758 -539530 -212115 -997908 -204564 -179708 -299463 -361809 -184635 -404535 -486924 -523485 -325915 -994709 -362479 -306049 -409557 -396553 -274368 -405130 -890259 -146977 -629060 -346864 -449741 -68849 -312587 -754613 -250554 -588706 -214285 -273313 -472291 -111502 -505493 -856958 -296721 -833180 -257792 -669874 -332704 -502098 -904592 -417431 -981484 -607003 -684173 -673045 -321634 -707752 -384900 -217689 -502362 -787947 -853036 -528405 -111055 -15726 …
Output: 932623

Example 3:

Input: 21 -857367 -592955 -952033 -709947 -644489 -609286 -698469 -526287 -694719 -729325 -89293 -479903 -472339 -375456 -875115 -427323 -578752 -129185 -976131 -720315 -522673
Output: 846946

Constraints:

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

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