CT37366

Fletcher Counts the windows

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The measurer Fletcher has been asked to approve the repair estimates. On the desk lies a long table of windows readings. 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 <= 1738; -1000000 <= a[i] <= 1000000000.

Example 1:

Input: 1141 548 721615024 147182476 892298048 626836928 75512450 709065796 213108211 920864049 70397118 728086118 396484576 50652514 143414042 158780449 637035469 367963121 486453036 245846950 247034903 40640235 853239666 306923272 933784512 485225958 122365790 348627656 751048510 625967164 101820140 338725778 269307745 836643681 615134761 183112244 217583063 146474128 784271410 794960928 471232426 803049576 406999997 851902212 66561581 987000813 268917644 14285711 573835970 14101922 670670653 699261450 517721734 866863159 243748094 511297938 54700724 19785820 615113139 822894225 176490957 678225645 650628382 89831881 985371423 431825338 494399160 522539390 523998856 501216304 99587805 805010682 280015862 798433024 993966688 738861714 152080534 707573516 139901065 613858756 989015120 606005588 40…
Output: 277406161698

Example 2:

Input: 424 146 480636100 599014187 775771272 44964305 963304978 648760073 43359645 86233880 412868649 273098810 339304013 185144117 116110161 725680501 584438981 -811061 824529753 914844127 816907143 848273690 519119916 367569834 6546837 784643517 743300780 127077658 615058640 644474445 817762249 189669991 550932686 357691670 186528247 109014336 378413713 335343939 858240010 326087979 864810091 798889576 74501234 380986919 379178652 937509523 517074268 822411785 280756006 327978672 756714344 440661209 837577501 211307401 32452244 355275030 889103400 971116948 420557808 819730771 483956515 519016564 884473664 914306014 180053080 303354890 315572944 593067530 664431831 329452862 232658729 922804206 626043688 664259877 668777807 986569519 314984295 90813604 260222775 146528905 95321121 538313062 710…
Output: 76526656886

Example 3:

Input: 758 716 297502883 55908053 434548177 549324594 72529041 450104343 829482245 190646466 934600592 915943784 893220785 485452285 770138543 143786660 320145925 853497653 200376388 566891005 825561503 571921317 701440934 877211769 586511303 930301940 113413289 383170357 684553733 990865553 543215191 544581641 183960409 416941525 51202380 42578174 189919558 746278980 632679005 3885386 274218793 934006951 108546947 963452926 599479226 207189583 391329682 458146740 962540190 469403208 202594014 10188185 618679758 661514239 677183384 477164082 877316214 221792537 684716410 789053212 761602964 474837909 924867947 267242950 164738759 681688571 512794797 800563349 166290169 234323704 836195455 855501543 59021142 745393958 450683552 17304672 353125331 28481912 564246488 229063284 306633284 109377605 43…
Output: 350062753808

Constraints:

1 <= k <= n <= 1738; -1000000 <= a[i] <= 1000000000.

Loading...
Test Cases:No test cases
No test cases available.
Fletcher Counts the windows - MEDIUM Coding Problem | CodeTikki