#P10098. Minimum Required Voltage
Minimum Required Voltage
Minimum Required Voltage
You are given n engines, each with an efficiency factor. When a voltage V (an integer) is applied to all engines, the power output of the i-th engine is defined as V times its efficiency factor a_i. The total power output is then:
$V \times \sum_{i=1}^{n}{a_i}$
Your task is to determine the minimum integer voltage V such that the total power output is greater than or equal to a given threshold p.
The answer can be mathematically represented as:
$V = \left\lceil \frac{p}{\sum_{i=1}^{n}{a_i}} \right\rceil$
inputFormat
The first line contains two integers, n
and p
, where n
is the number of engines and p
is the required minimum total power.
The second line contains n
space-separated integers a_1, a_2, ..., a_n
representing the efficiency factors of the engines.
outputFormat
Output a single integer representing the minimum voltage V
that satisfies the condition.
sample
3 100
30 20 10
2