#K76977. Lowest Effective Monthly Subscription Cost
Lowest Effective Monthly Subscription Cost
Lowest Effective Monthly Subscription Cost
You are given a number of subscription plans. Each plan has a base cost and one or more discount blocks. Each discount block provides a discount percentage valid for a specified number of months. The effective monthly cost for a discount block is calculated as follows:
$$\text{Effective Cost} = \text{Base Cost} \times \Bigl(1 - \frac{\text{Discount}}{100}\Bigr)$$
Your task is to determine the minimum effective monthly cost, rounded down to the nearest integer, among all discount blocks across all subscription plans.
Note: Even though each discount block provides a promotional period (in months), the monthly cost is computed solely based on the base cost and discount percentage.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer
T
representing the number of subscription plans. - For each subscription plan, the following lines are provided:
- A line with an integer representing the base cost.
- A line with an integer
B
indicating the number of discount blocks for this plan. B
subsequent lines each contain two integers. The first integer represents the number of months and the second integer represents the discount percentage.
outputFormat
Output to standard output (stdout) a single integer representing the lowest effective monthly cost among all provided subscription plans, rounded down to the nearest integer.
## sample2
100
2
6 5
12 10
200
1
3 20
90