CT47129

Sahil's scrolls Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the island market of Coralcove pays by the answer, and Sahil intends to earn it. First: the full register of scrolls. Task: Print the maximum sum of any contiguous subarray of length exactly k. Input format: First line: n and k. Second line: n integers. Output format: Print the maximum window sum. Constraints: 1 <= k <= n <= 1227; 1 <= a[i] <= 1000000.

Example 1:

Input: 253 213 267890 675235 807255 6048 766477 922160 635283 18587 116456 193362 170966 869540 530686 2169 257334 728459 44601 181736 724518 557092 571494 57723 98326 445458 113781 31722 584753 592422 823544 744095 757596 959146 154063 275778 708990 53953 368940 399189 495906 535936 773571 620358 377198 188788 873109 169868 8034 996844 284046 444688 232794 544074 915973 893095 123946 525980 721075 402655 827051 39786 957500 132018 673992 987969 910470 129294 69890 553783 658011 552584 481665 377141 105392 628309 210033 809566 692927 684043 324044 129093 129071 665051 152975 288377 395128 814559 920910 891985 457197 650838 846667 908187 610961 815264 606065 324140 458443 38594 451920 578104 25592 344903 241509 647271 197620 427392 462687 117833 697999 28334 745912 877200 236709 52183 914101 21368…
Output: 100724484

Example 2:

Input: 66 53 563085 128198 504396 56115 522499 684110 784991 262926 647879 650494 461627 331669 767290 625899 729333 164878 557269 999900 324057 141748 119761 177179 669015 239707 329647 550845 156423 795636 321419 782866 387447 610055 775738 100753 356243 732817 201762 436119 864035 258544 215518 103479 998661 668727 227536 400080 137303 419533 149020 565300 399278 431018 299583 349565 874431 794951 866987 885292 663670 614937 80022 548944 526153 38982 29948 449894
Output: 25786343

Example 3:

Input: 1094 812 704312 986011 680745 559464 956400 476352 174271 51505 434884 588357 434492 355337 668058 775998 225181 134616 62067 378648 759075 155659 453374 702197 855892 46194 994553 975098 642191 693217 413538 555246 226080 925559 503456 204800 240382 152630 417096 390902 556621 955558 767570 344142 316738 521345 462375 32768 175295 811335 82350 451389 497917 998525 380083 264313 887713 548663 249776 238556 955847 620285 258731 399369 979655 543990 99717 743416 499002 435081 427480 253888 115556 881895 308610 258756 337174 599441 419030 245598 350725 428214 400934 211079 787018 339984 267392 578812 717599 392757 58238 815714 609276 685679 151221 503164 514945 321523 308020 278776 320269 544479 539338 905007 896119 546087 124526 244917 918094 602058 438986 359611 696583 419235 66703 686222 6…
Output: 401980580

Constraints:

1 <= k <= n <= 1227; 1 <= a[i] <= 1000000.

Loading...
Test Cases:No test cases
No test cases available.
Sahil's scrolls Reckoning - MEDIUM Coding Problem | CodeTikki