#C10014. Discounted Book Price Calculation
Discounted Book Price Calculation
Discounted Book Price Calculation
You are given the number of books and their prices. You must compute the final price after applying a discount according to the following rules:
- If there is only one book, no discount is applied.
- If there are exactly two books, a discount of \(5\%\) is applied.
- If there are exactly three books, a discount of \(10\%\) is applied.
- If there are four or more books, a discount of \(20\%\) is applied.
The final price should be rounded to two decimal places.
inputFormat
The input is read from stdin. The first line contains an integer T representing the number of test cases. Each test case consists of two lines: the first line contains an integer N (the number of books) and the second line contains N space-separated integers representing the prices of the books.
outputFormat
For each test case, output a single line with the discounted total price rounded to two decimal places, printed to stdout.
## sample3
1
20
2
30 50
4
15 25 35 45
20.00
76.00
96.00
</p>