CT34943

The weights at Sunspire

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Caravans arrive at the temple city of Sunspire with crates of weights, and Lamplighter the tallyman must account for every last one. Task: Print how many array elements are less than or equal to x. Input format: First line: n and x. Second line: n integers. Output format: Print the count of elements <= x. Constraints: 1 <= n <= 7454; 0 <= a[i],x <= 1000.

Example 1:

Input: 2861 719 800 355 649 10 170 549 107 695 275 836 844 476 986 584 792 834 1 856 684 879 889 254 122 73 598 294 942 29 267 490 781 496 721 321 655 854 233 759 646 369 402 745 590 270 83 984 457 175 362 297 90 263 722 581 647 332 555 552 343 342 188 645 793 700 518 691 759 196 677 16 514 593 696 208 610 938 462 8 895 282 982 88 248 165 58 96 791 2 580 658 984 388 664 932 15 278 165 623 263 141 491 253 580 782 548 680 681 121 924 577 599 807 799 426 666 271 182 75 844 381 646 604 281 400 936 147 738 792 452 798 597 117 376 659 268 920 102 927 397 574 617 762 749 591 506 903 562 891 683 626 527 15 894 978 104 89 976 814 229 198 891 95 387 337 260 866 67 384 353 66 192 997 925 358 764 134 333 723 66 786 184 952 373 804 129 766 504 605 373 605 396 807 205 505 447 863 405 662 183 440 886 266 924 18…
Output: 2056

Example 2:

Input: 2132 476 519 612 309 575 274 831 821 427 998 894 821 742 877 503 367 644 951 914 579 69 203 777 303 497 209 723 145 730 281 161 308 84 212 481 252 524 30 363 771 172 470 768 214 760 548 223 604 680 417 661 264 635 215 27 493 702 482 80 242 105 485 503 170 644 680 186 452 277 486 90 892 978 933 498 644 537 938 160 144 897 79 431 212 689 320 192 449 407 683 865 374 879 468 473 627 560 162 960 107 929 464 565 51 98 926 82 306 544 332 349 634 294 967 403 71 510 189 346 808 916 601 44 650 586 571 823 580 558 497 48 838 35 233 815 596 91 259 519 596 768 546 374 418 988 515 753 361 909 276 602 511 991 985 860 207 877 165 895 403 609 229 451 384 830 448 941 910 223 669 934 703 330 343 739 783 521 872 798 642 519 781 583 782 623 850 766 52 177 234 700 18 992 51 700 879 760 521 813 814 864 704 609 6…
Output: 1005

Example 3:

Input: 4994 906 645 654 782 976 876 323 604 15 947 880 609 486 326 585 339 146 425 165 328 182 168 558 681 246 635 195 415 857 631 669 240 275 386 996 434 889 208 212 765 660 830 546 270 173 196 898 410 455 369 470 650 83 671 823 986 658 432 523 722 935 357 808 110 427 211 298 687 628 390 156 151 22 881 527 863 707 757 436 953 374 287 363 948 736 580 927 787 132 535 385 957 264 215 717 155 335 358 751 503 847 365 364 754 270 451 826 832 406 817 305 766 395 144 201 585 746 211 49 241 404 886 711 190 200 761 882 909 422 577 754 731 227 896 819 447 359 665 892 83 763 729 485 172 455 873 976 966 249 588 690 723 768 484 389 228 613 264 439 378 958 123 423 754 908 503 945 148 642 734 294 493 531 741 172 572 970 319 157 542 760 282 298 198 682 23 131 792 493 751 448 130 198 624 163 150 452 604 360 497 7…
Output: 4568

Constraints:

1 <= n <= 7454; 0 <= a[i],x <= 1000.

Loading...
Test Cases:No test cases
No test cases available.
The weights at Sunspire - MEDIUM Coding Problem | CodeTikki