CT23853

Kavi's coins Reckoning

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

The harbor bell rings at the basalt cliffs of Obsidian Shore; Kavi weighs the day's coins manifests and starts the calculations. 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 <= 515; 0 <= a[i] <= 1000000; answers fit a signed 64-bit integer.

Example 1:

Input: 311 439843 934868 888174 841876 706910 939007 410071 438130 521122 377701 424804 989944 299665 582856 660573 971860 116934 292135 4641 504333 336664 259123 707351 980435 52227 460552 884954 272867 458801 150583 563949 475894 171311 403512 677678 417559 953022 717035 442606 31567 968998 434337 187458 973641 445024 129128 152016 503846 86407 876818 623821 324427 936710 71985 963289 922938 40544 243449 668531 956867 214918 57200 952486 688531 875463 882398 908463 936308 424001 362376 399299 501419 751681 285697 941479 32424 459802 869805 610313 445105 817246 710238 186782 574957 527547 386964 78155 213904 675118 191625 841740 214568 909243 572179 91664 962648 363874 307284 966137 314826 116545 690931 602912 206487 657292 942549 71726 890220 752448 321688 730706 235635 142141 614135 89667 9954…
Output: 978546

Example 2:

Input: 447 860305 783878 452365 363474 474524 682545 771 706937 683317 846676 48657 258952 468801 296487 715792 617798 617102 823796 857880 113939 561910 910826 774863 25326 759320 470491 876190 840872 506786 401885 746264 780723 549717 418957 116624 620141 864736 307051 743568 315563 673920 505195 853050 371734 743625 851835 891986 394129 630159 164732 908239 489964 521866 446812 264911 378093 147773 398848 790884 505842 738993 457150 415010 172823 736420 303479 289395 680864 720727 285278 61276 186858 715268 64822 129370 632316 486652 861413 746864 537876 301884 793064 413557 416592 942777 698066 627772 865361 520696 773228 884045 445169 239132 239574 659901 465793 409420 275969 815007 104773 103743 787020 65308 622551 537718 784560 273177 771715 691019 248882 602818 781136 405570 360368 707281…
Output: 942739

Example 3:

Input: 500 793277 632509 128290 975802 860266 620521 425437 928799 829366 260569 878432 216070 855109 938282 203265 516839 629686 461016 814788 896485 686169 736130 684074 541907 326514 785848 743358 593951 576724 344330 219322 159227 476031 176493 367219 19573 714215 517999 425961 672715 276854 18674 813853 987623 784519 2624 967583 842170 339938 887766 153527 237935 130880 481755 273000 604658 362625 227772 127201 745240 684361 745165 29550 449535 885235 720438 973304 504360 908578 443436 637771 587159 818000 793277 702621 409132 142529 431726 667984 220442 3890 543858 601250 920733 972928 857015 371986 967931 756591 393981 353696 24064 939145 205683 443086 311097 386029 862091 632748 664039 429044 468138 851715 230097 125669 301275 1950 257164 3582 237677 969881 268097 945552 520313 475066 829…
Output: 964959

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Kavi's coins Reckoning - EASY Coding Problem | CodeTikki