#P9240. [蓝桥杯 2023 省 B] 冶炼金属
[蓝桥杯 2023 省 B] 冶炼金属
Problem Description
Xiao Lan has a magical furnace that can smelt ordinary metal O into a special metal X. The furnace has a property called the conversion rate . is a positive integer, meaning that consuming exactly units of ordinary metal O can smelt one unit of special metal X. When the amount of ordinary metal O is less than , smelting cannot continue.
Now you are given smelting records. Each record contains two integers and , meaning that units of ordinary metal O were put in, and finally units of special metal X were produced. Each record is independent, which means any ordinary metal O left over from the previous record will not be carried over to the next smelting.
Based on these smelting records, please infer the minimum and maximum possible values of the conversion rate . It is guaranteed that the testdata always has at least one solution.
Input Format
The first line contains an integer , representing the number of smelting records.
Then follow lines, each containing two integers , with the meaning described above.
Output Format
Output two integers, representing the minimum and maximum possible values of , separated by a space.
3
75 3
53 2
59 2
20 25
Hint
Sample Explanation
When , we have: $\left\lfloor\frac{75}{20}\right\rfloor=3,\left\lfloor\frac{53}{20}\right\rfloor=2,\left\lfloor\frac{59}{20}\right\rfloor=2$, which satisfies all smelting records.
When , we have: $\left\lfloor\frac{75}{25}\right\rfloor=3,\left\lfloor\frac{53}{25}\right\rfloor=2,\left\lfloor\frac{59}{25}\right\rfloor=2$, which also satisfies all smelting records.
And we can no longer find a valid that is smaller than or larger than .
Constraints
For of the test cases, .
For of the test cases, .
For of the test cases, , .
Lanqiao Cup 2023 Provincial Contest B Group, Problem C.
Translated by ChatGPT 5