#C2088. Maximum Simultaneous Data Transfer Sessions
Maximum Simultaneous Data Transfer Sessions
Maximum Simultaneous Data Transfer Sessions
You are given a network of n computers where each computer has a certain load capacity. In each data transfer session, every computer contributes one unit of its capacity. The task is to determine the maximum number of simultaneous sessions that the network can support without overloading any computer. This number is equal to the minimum of the load capacities of all the computers.
For example, if there are 5 computers with capacities [1, 2, 1, 2, 1], then only one session can occur because at least one computer can only handle one session. Similarly, if all computers have the same capacity, that common value will be the maximum number of sessions that can take place concurrently.
If there are no computers (i.e. n = 0), the output should be 0.
inputFormat
The input consists of two lines:
- The first line contains a single integer n – the number of computers.
- The second line contains n space-separated integers representing the load capacities of the computers. If n is 0, the second line will be empty.
outputFormat
Output a single integer representing the maximum number of simultaneous data transfer sessions that can occur without overloading any computer.
## sample5
1 2 1 2 1
1