#K39032. Water Consumption Cost Calculation
Water Consumption Cost Calculation
Water Consumption Cost Calculation
You are given the water consumption (in cubic meters) and the base rate per cubic meter for a household. Your task is to calculate the total cost for the water consumption. If the consumption exceeds 500 cubic meters, an additional surcharge of 5% of the basic cost is applied.
The total cost is calculated as follows:
$$\text{total_cost} = \begin{cases} consumption \times base\_rate, & \text{if } consumption \leq 500,\\ consumption \times base\_rate \times 1.05, & \text{if } consumption > 500. \end{cases} $$Output the total cost rounded to two decimal places for each test case.
inputFormat
The first line contains an integer T representing the number of test cases. Each of the next T lines contains two space-separated integers — consumption
and base_rate
.
outputFormat
For each test case, output a single line with the calculated total cost, rounded to two decimal places.
## sample3
400 2
600 3
500 5
800.00
1890.00
2500.00
</p>