#K81852. Count the Deliverable Parcels
Count the Deliverable Parcels
Count the Deliverable Parcels
You are given a list of parcel weights and a truck's maximum capacity. Each truck can only carry one parcel and will only deliver it if its weight is less than or equal to the truck's maximum capacity. Your task is to determine the minimum number of trucks needed to deliver the parcels that meet the weight requirement.
In other words, given a list of weights (w_1, w_2, \dots, w_n) and an integer (C) representing the truck's maximum capacity, you need to count how many weight values satisfy (w_i \leq C).
inputFormat
Input is given from standard input (stdin) in the following format:
- The first line contains two space-separated integers: (n) (the number of parcels) and (C) (the maximum capacity of the truck).
- The second line contains (n) space-separated integers representing the weights of the parcels.
outputFormat
Output a single integer to standard output (stdout), which is the count of parcels that can be delivered (i.e. the number of weights (w_i) such that (w_i \leq C)).## sample
4 5
2 3 4 1
4