CT21982

The Copper ingots of Gino

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Morning light hits the railway depot of Cinderline as Gino 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 <= 204; -1000000 <= a[i] <= 10; answers fit a signed 64-bit integer.

Example 1:

Input: 38 -540316 -550606 -338987 -684632 -117326 -966659 -234761 -92292 -746076 -69261 -230286 -437535 -89050 -733955 -108504 -427694 -816387 -557768 -840448 -376515 -473011 -695509 -113092 -382300 -572279 -252210 -441173 -439980 -287524 -577216 -326775 -652156 -725513 -461582 -638716 -642426 -640882 -960400
Output: 849333

Example 2:

Input: 194 -774902 -394143 -448163 -160190 -715525 -432902 -460042 -819937 -200627 -468955 -682547 -789412 -144814 -533848 -49928 -75111 -833397 -476795 -905551 -699304 -131202 -603382 -326796 -554673 -578814 -36436 -31884 -911927 -916196 -301860 -685806 -164046 -131708 -959602 -915750 -449223 -455670 -569939 -440495 -216632 -655467 -59218 -665990 -378186 -21503 -556551 -431943 -528802 -881454 -568173 -18773 -409891 -50192 -964663 -761998 -269456 -310527 -812230 -848636 -83351 -880095 -348402 -280546 -653959 -850638 -110733 -909698 -932174 -189326 -760313 -773548 -330732 -390573 -861958 -946596 -442056 -243554 -620807 -275003 -936144 -796919 -507883 -109820 -104300 -43076 -464601 -379148 -499286 -447593 -222365 -976936 -386929 -632403 -762745 -859934 -697304 -174147 -887053 -338832 -283818 -13871 -958750 -133649 -36315 -956952 -244248 -167206 -333112 -221910 -857534 -405532 -143821 -833372 -785789 -382057 -839368 -720238 -645977 -976987 -124279 -26143 -104309 -818689 -518712 -687783 -91796 -575162 -387764 -42032 -579811 -730855 -356016 -702011 -476826 -755841 -495631 -930451 -610859 -583148 -809131 -789887 -678464 -439994 -849898 -714001 -702145 -880073 -974696 -523460 -960708 -452018 -786325 -939725 -911359 -154778 -574192 -150395 -335105 -769380 -576727 -858062 -67397 -763615 -393389 -713901 -998557 -419749 -522203 -480787 -88950 -880649 -468546 -262590 -797860 -680306 -767792 -958656 -129434 -619561 -715259 -626823 -587552 -349411 -889654 -676647 -457489 -116083 -696997 -819653 -633788 -185281 -524225 -183012 -66443
Output: 944879

Example 3:

Input: 90 -965865 -463709 -690033 -854146 -160591 -444471 -487225 -510824 -153995 -481797 -900021 -650678 -307765 -331071 -842963 -587498 -371824 -560079 -757379 -643175 -48088 -928 -894843 -192141 -916304 -322642 -241251 -669936 -199456 -992385 -268136 -327189 -235266 -258425 -302846 -515089 -793271 -231526 -978703 -740942 -875216 -222687 -747692 -980012 -888326 -486552 -294220 -43704 -100190 -967617 -196524 -315657 -363270 -221083 -417404 -629593 -73967 -660679 -29285 -421709 -130853 -914605 -201132 -702408 -674094 -874708 -195186 -542791 -472564 -393277 -361032 -745117 -711240 -65810 -398056 -330540 -364728 -758039 -650703 -324783 -152611 -339089 -265683 -523179 -144700 -190197 -264412 -115238 -224262 -326152
Output: 893915

Constraints:

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

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