CT27624

Hestia Counts the coins

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

The council of the crystal caves of Luminar pays by the answer, and Hestia intends to earn it. First: the full register of coins. 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 <= 648; -100 <= a[i] <= 10; answers fit a signed 64-bit integer.

Example 1:

Input: 341 7 -100 -50 7 6 -16 -43 -60 -14 -97 -83 -69 -3 -7 1 -35 -36 -42 -25 -67 -88 6 2 -38 -15 -49 -72 -82 -64 -30 -27 -16 -77 -50 -91 -67 -1 -43 -61 -61 3 -54 -23 -90 -19 6 -37 -67 -55 -15 -5 -18 -55 -93 -93 8 5 -51 -88 -8 -7 -49 -20 -72 -70 -47 5 -67 -57 -38 -62 2 -65 -22 -77 -30 -67 -26 -63 -27 -45 2 -71 -34 -48 -28 -82 -10 -73 -93 -37 -48 -23 -82 -56 -82 -33 -47 -13 -96 -64 -34 -90 10 -45 -35 9 -83 -69 -25 -45 -40 -96 -28 -55 -88 -40 -98 -9 -86 -62 -66 -19 -48 -24 -23 -41 -18 -86 -60 -20 -45 4 -3 -31 -100 -94 -71 5 2 -25 -59 -86 -98 -58 -85 -19 -43 -50 -82 -77 -8 -99 -86 -28 5 -46 -91 -7 -99 -33 -89 -47 0 -61 -58 -3 -45 -83 -60 -99 -78 -33 -90 -55 9 -66 -64 1 -38 -81 -53 -3 -62 -18 -39 -40 -2 10 -99 -39 -72 -96 -2 -44 -88 -62 -25 -89 -78 -34 -47 -58 -5 -51 3 -61 -84 -11 -15 -94 -59 -33 -15…
Output: 109

Example 2:

Input: 380 -41 -97 -93 -49 -93 -26 -76 -25 -55 3 0 -99 -97 10 -26 -31 -56 -97 -13 -98 -79 -21 -29 -16 -82 -98 -47 -12 -31 -10 -38 -17 2 -11 -77 -68 -25 -89 -16 -24 3 7 -45 -43 -6 -60 -95 -51 -91 -29 -12 -72 -21 -30 -78 -83 -95 -47 -50 -83 -94 -13 -24 -21 -54 -65 9 -41 -60 -30 -75 -54 -6 -19 -30 -83 -100 -8 -94 -62 -2 -28 5 -46 -8 -60 -55 -18 -57 -93 -92 -89 -97 -85 -47 -43 -86 -94 -14 -48 3 -81 -17 -42 -56 -38 -52 -89 -72 -87 -33 -25 -41 -55 -24 -72 -90 -20 -69 -43 -5 -41 -41 -5 9 -40 -49 -84 -39 -52 5 -50 -40 -4 -15 -45 -15 -68 -6 -98 -45 -87 -35 -28 -85 -3 -34 -51 -28 -47 -97 -28 -98 -100 0 -39 -37 -50 1 -68 -9 -57 -5 -99 -74 10 -30 -65 -98 -60 -48 -74 -27 -81 -25 -18 -39 10 -47 -67 -84 -22 -6 -41 -22 -31 -93 -42 3 -74 -81 -57 -71 -34 -48 -43 -22 -6 -79 -67 -4 -5 -99 -58 -60 -52 -2 -79 -2 -72 -…
Output: 109

Example 3:

Input: 439 -26 -79 -94 6 -80 1 6 -98 4 -16 -81 -56 -36 -44 -100 -98 -56 -96 -100 -22 -5 -27 -82 -20 -76 -11 -45 -22 -77 -38 -99 -13 -56 -12 4 3 -86 -43 -59 -39 -84 -76 -52 -39 0 -32 -22 -86 -95 -24 -20 -23 -23 -28 -43 -67 -12 -85 6 -17 -6 -49 -81 -42 -67 -37 -93 9 -50 -43 7 -58 -23 -89 -50 -19 -38 -27 -11 -51 -91 -38 -48 -79 -35 -32 -43 -32 -22 -70 -71 -13 -17 8 -48 -46 -87 4 -30 -30 0 -10 -33 -22 -47 -46 -93 1 -20 -33 -53 -34 -37 -65 -48 -53 -63 -29 -58 -14 -32 -85 1 -100 -84 -79 -52 -55 -66 -33 -57 -43 -22 -65 -58 -29 -43 -96 -13 -51 -23 -71 -84 -8 -34 -8 6 -58 -29 -8 -22 -37 -66 7 -36 -86 -81 -58 -68 -27 -66 -6 -27 -57 -12 -71 -89 -32 -60 -32 -79 -24 -75 -9 -48 -56 -86 -73 -16 -37 -89 -40 -51 -25 -22 -31 -23 -71 -37 -39 9 -35 8 -52 -13 -46 -24 -62 -14 2 -8 -19 -8 -64 -48 -58 -64 -47 1 -83 1 -9…
Output: 104

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Hestia Counts the coins - EASY Coding Problem | CodeTikki