CT1519

Starlit crates Occurrence Count

EasyL2 · Byte BanditAcceptance: 0.0%XP: 10

Cartwright found an old ledger of crates in the workshop attic at the silver mines of Lodebarrow. The margin notes pose a precise question. 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 <= 46; -1000000 <= a[i],x <= 10.

Example 1:

Input: 34 -148889 -262360 -832385 -721709 -713174 -472554 -677949 -632910 -157791 -521210 -454456 -707967 -470121 -3170 -436544 -82724 -932524 -493812 -377963 -353227 -232328 -435796 -943862 -380958 -398210 -620662 -895974 -198183 -613703 -973589 -840559 -120803 -945165 -524086 -576589
Output: 0

Example 2:

Input: 25 -522971 -635808 -77539 -400168 -653988 -191278 -731979 -272551 -375851 -735282 -26925 -181790 -934333 -87457 -110836 -438882 -909657 -687741 -362416 -330583 -174558 -975684 -363225 -787071 -868983 -868862
Output: 0

Example 3:

Input: 20 -649165 -43789 -537232 -467245 -845118 -565329 -723767 -560848 -229140 -136285 -820593 -399352 -538919 -805580 -5217 -45452 -618015 -297394 -187795 -552691 -960170
Output: 0

Constraints:

1 <= n <= 46; -1000000 <= a[i],x <= 10.

Loading...
Test Cases:No test cases
No test cases available.
Starlit crates Occurrence Count - EASY Coding Problem | CodeTikki