[Huawei OD Unified Exam B Paper | 200 points] Delegation rides (C++ Java JavaScript)

Title description: The delegation rides in a car

An organization holds a meeting, and multiple delegations arrive at the same time. There is only one car at the reception, which can receive multiple delegations at the same time. In order to improve the utilization rate of vehicles, please help the receptionist calculate the reception plan that can fill the car, and output the plan quantity.

constraint:

  1. A group can only board one car, and the number of delegations (the number of delegations is less than 30, and the number of each delegation is less than 30) is less than the car capacity (the car capacity is less than 100)
  2. Need to fill up the vehicle

enter description

The number of delegations in the first line, separated by English commas, the number of delegations is less than 30, the number of each delegation is less than 30 The
second line is the passenger capacity of the car, the car capacity is less than 100

output description

The number of solutions that are full of cars
If there is no solution, output 0

ACM input and output mode

If you often use Leetcode , you will know that letcode does not need to write input and output functions. However, the Huawei OD machine test uses the ACM mode , which requires manual programming of input and output.

So it is best to familiarize yourself with this mode in advance on Niu-ke. For example, C++ is used cin/cout, and python is used input()/print(). JavaScript uses node's readline()and console.log(). use javasacnner/system.out.print()

Example

enter

5,4,2,3,2,4,9
10

output

4

Description<

Guess you like

Origin blog.csdn.net/shangyanaf/article/details/131157132