#K14641. Electric Car Battery Management

    ID: 24180 Type: Default 1000ms 256MiB

Electric Car Battery Management

Electric Car Battery Management

An electric car is powered by multiple battery cells, each storing a certain amount of energy. For each trip, the car requires an energy amount E. The car can only embark on a trip if the total stored energy in its battery cells is at least E. After each complete trip, the energy that remains is preserved (i.e. cells are not recharged during the simulation), and the car continues to make trips until the remaining energy is insufficient for another complete trip.

You are required to compute the maximum number of complete trips the car can make, given the energy requirement for a trip and the energy available in each battery cell. The number of complete trips is determined using the formula:

$$\text{Trips} = \left\lfloor \frac{\text{total energy}}{E} \right\rfloor $$

where the total energy is the sum of energies from all battery cells. Your task is to process multiple test cases, where each test case provides the energy required per trip, the number of battery cells, and a list of energy values for each cell.

inputFormat

The first line of the input contains an integer T denoting the number of test cases. For each test case, the input is given in two lines:

  • The first line contains two integers E and N, where E is the energy required for one complete trip and N is the number of battery cells.
  • The second line contains N space-separated integers, each representing the energy stored in a battery cell.

outputFormat

For each test case, output a single integer representing the maximum number of complete trips the electric car can perform. Each result should be printed on a new line.

## sample
2
5 3
4 3 2
10 5
5 6 7 8 9
1

3

</p>