CT23033

Silent ingots Occurrence Count

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

In the ivory gates of Alabast, Yami the measurer keeps careful count of the ingots. Prepare the expedition manifest, every figure matters. Task: Read n integers and a target x; print how many times x occurs. Input format: First line: n and x. Second line: n space-separated integers. Output format: Print the number of occurrences of x. Constraints: 1 <= n <= 473; -100 <= a[i],x <= 1000.

Example 1:

Input: 371 343 882 837 225 425 692 953 287 743 865 825 765 772 565 477 832 498 963 897 975 391 615 920 986 435 417 -48 512 591 265 438 -96 3 815 990 933 672 -30 829 4 499 76 378 132 935 900 545 427 321 -33 408 469 18 408 870 -1 613 -39 785 245 595 736 74 727 148 326 788 499 571 103 -86 612 402 690 524 438 866 698 402 868 126 123 750 543 691 424 31 443 -3 124 487 920 398 343 896 779 38 411 28 732 54 690 274 1 268 611 770 542 111 -63 262 221 928 99 984 236 -38 116 356 485 -6 818 768 116 -64 433 91 769 409 742 792 459 857 93 -74 578 897 486 46 659 540 216 811 -25 83 728 980 913 201 594 -62 707 325 27 509 383 821 343 239 427 625 481 15 623 -17 389 349 387 595 929 816 272 583 729 195 -7 324 574 520 615 602 177 144 339 888 660 88 100 552 113 179 891 864 887 776 773 747 257 -60 421 457 875 646 431 803 9…
Output: 2

Example 2:

Input: 414 576 151 -14 -50 -81 621 -70 734 298 107 916 565 839 947 982 733 589 31 298 378 132 971 181 405 164 -61 931 873 555 826 924 425 260 21 975 516 693 941 406 936 66 773 205 228 496 129 25 430 44 510 945 450 168 865 324 658 179 50 129 710 645 750 256 466 417 804 -12 446 945 385 12 712 226 99 821 65 206 251 12 258 303 57 530 600 961 221 587 -66 437 673 247 246 700 988 665 34 683 508 337 586 989 -76 246 555 932 981 435 920 974 774 578 561 -3 352 896 317 759 121 256 109 540 93 167 362 528 1 884 368 532 349 341 283 -57 63 999 401 -66 225 929 992 217 914 2 90 -93 125 64 929 40 703 745 665 924 801 -78 -44 403 415 15 -57 740 504 -51 -8 556 179 191 355 765 -88 701 -48 914 267 892 277 -88 832 416 270 37 -28 428 680 327 799 588 892 158 136 302 715 655 388 601 881 353 879 176 440 299 948 426 140 447 6…
Output: 0

Example 3:

Input: 257 799 248 909 69 889 872 238 797 -76 165 696 775 365 750 179 -97 52 748 278 452 588 637 127 380 669 396 838 408 489 826 206 -29 842 -97 516 905 732 396 63 488 -69 318 62 511 -94 145 -41 771 14 11 384 844 572 558 328 588 660 608 458 54 478 739 994 123 355 129 643 70 803 169 709 221 -72 850 533 743 496 856 792 382 604 622 529 648 466 449 916 539 144 896 662 166 -29 361 -42 579 -20 104 13 183 801 -86 240 863 797 405 779 707 212 248 123 -35 711 31 -40 945 673 284 370 878 69 828 510 474 920 21 463 404 709 540 1 884 -91 223 -59 -6 813 374 246 686 -75 700 204 402 459 789 830 864 608 -67 74 113 765 784 481 -8 691 635 671 63 279 80 186 326 967 -89 209 539 732 747 839 535 864 334 992 156 193 334 976 773 138 109 495 467 619 -33 604 611 846 265 889 96 420 141 77 740 737 361 705 609 58 699 525 758 49…
Output: 0

Constraints:

1 <= n <= 473; -100 <= a[i],x <= 1000.

Loading...
Test Cases:No test cases
No test cases available.