#K59977. Magical Operations to Gather Ingredients
Magical Operations to Gather Ingredients
Magical Operations to Gather Ingredients
You are given N ingredients, where the i-th ingredient requires exactly k_i units. In one magical operation, you can collect m_i units of the i-th ingredient. Your task is to determine the minimum number of magical operations required so that for each ingredient you collect at least the required number of units.
For each ingredient, the minimum operations is computed as:
\(\lceil \frac{k_i}{m_i} \rceil = \frac{k_i + m_i - 1}{m_i}\)
The total number of operations is the sum of operations over all ingredients.
inputFormat
The first line contains a single integer N representing the number of ingredients.
The following N lines each contain two space-separated integers k and m, where k is the required units of the ingredient and m is the units collected per magical operation.
outputFormat
Output a single integer, representing the minimum number of magical operations required to collect at least the required units for each ingredient.
## sample3
10 3
15 4
20 5
12