#K10836. Calculate Total Cost with Discount
Calculate Total Cost with Discount
Calculate Total Cost with Discount
You are given the number of days, the number of meals per day, and the daily cost. The total cost is the product of the number of days and the cost per day. However, a discount is applied depending on the total number of meals purchased over all days:
- If the total meals is less than 10, no discount is applied.
- If the total meals is between 10 (inclusive) and 30 (exclusive), a 10% discount is applied.
- If the total meals is 30 or more, a 20% discount is applied.
Your task is to calculate the discounted total cost.
The discount formula can be formulated in LaTeX as follows:
\[ \text{total\_cost} = \text{days} \times \text{cost\_per\_day} \quad\text{and}\quad \text{discounted\_cost} = \text{total\_cost} \times \left(1 - \text{discount}\right), \]
where \(\text{discount} = \begin{cases} 0 & \text{if } days \times meals\_per\_day < 10,\\ 0.10 & \text{if } 10 \leq days \times meals\_per\_day < 30,\\ 0.20 & \text{if } days \times meals\_per\_day \geq 30. \end{cases}\)
inputFormat
The first line of the input contains an integer \(T\) denoting the number of test cases. Each of the next \(T\) lines contains three integers: \(days\), \(meals\_per\_day\), and \(cost\_per\_day\), separated by spaces.
For example:
2 1 9 100 10 3 100
outputFormat
For each test case, output the discounted total cost as a floating-point number rounded to one decimal place. Each result should be printed on a new line.
## sample1
1 9 100
100.0