#C10164. Calculate Final Price After Discount
Calculate Final Price After Discount
Calculate Final Price After Discount
You are given an integer n representing the number of customers. For each customer, you are provided with two integers: the original price p and the discount percentage d. Your task is to calculate the final price after applying the discount for each customer.
The discount is applied using the formula:
$$ final\_price = \max\Big(\text{round}\Big(p \times \Big(1 - \frac{d}{100}\Big)\Big), 1\Big) $$
Note that the discount calculation involves rounding to the nearest dollar, and the final price cannot be less than 1.
inputFormat
The first line of input contains an integer n representing the number of customers. Each of the following n lines contains two space-separated integers, p and d, where p is the original price and d is the discount percentage.
outputFormat
Output a single line containing n space-separated integers. Each integer denotes the final price of a customer after applying the discount.
## sample3
100 20
50 50
10 90
80 25 1