#K72217. Minimum Cost Calculation with Bulk Discount
Minimum Cost Calculation with Bulk Discount
Minimum Cost Calculation with Bulk Discount
You are given the number of books (n), a discount percentage (d), and a list of book prices. The shop offers a bulk discount if at least three books are purchased. Specifically, if (n \ge 3), the total cost is discounted by (d)% otherwise no discount is applied. The total cost is computed as (C = \sum_{i=1}^{n} c_i) and the discounted cost is (C \times \left(1 - \frac{d}{100}\right)). Your task is to compute the final amount a customer has to pay. The answer should be rounded to two decimal places.
inputFormat
The input is read from standard input (stdin). The first line contains two integers, (n) (the number of books) and (d) (the discount percentage), separated by a space. The second line contains (n) space-separated integers representing the prices of the books. If (n = 0), the second line will be empty.
outputFormat
Output the final amount the customer has to pay, rounded to two decimal places, to standard output (stdout).## sample
5 20
100 200 300 400 500
1200.00
</p>