#K64362. Minimum Number of Trucks Required

    ID: 31959 Type: Default 1000ms 256MiB

Minimum Number of Trucks Required

Minimum Number of Trucks Required

You are given the number of packages to be delivered to each destination. A truck has a maximum capacity and can carry a limited number of packages. Your task is to determine the minimum number of trucks required to deliver all packages.

If the total number of packages is \(T\) and the truck capacity is \(C\), then the minimum number of trucks needed is computed using the ceiling function:

\(\lceil \frac{T}{C} \rceil\)

For example, if there are 4 destinations with package counts [4, 8, 15, 6] and the truck capacity is 10, then the total packages are 33, and the answer is \(\lceil 33/10 \rceil = 4\).

inputFormat

The input is read from standard input and consists of three lines:

  • The first line contains an integer \(n\), the number of destinations.
  • The second line contains \(n\) space-separated integers, where each integer represents the number of packages at a destination.
  • The third line contains an integer \(C\), representing the truck's capacity.

outputFormat

The output is a single integer written to standard output, representing the minimum number of trucks required.

## sample
4
4 8 15 6
10
4