P7621 [AHOI2021 Junior] Supermarket Shopping
Background
AHOI2021 Junior T1.
**You may choose to skip the background section.**
One spring day, when it was still cold even though it was getting warmer, a strong wind suddenly rose. Little Keke wrapped his thin coat tighter and hurried to Xiaoxue’s home.
“Today is really not a day to go out!” Little Keke sighed.
“But I still have something to buy... can you go to the supermarket with me?”
In the supermarket, Xiaoxue bought items worth 23.70 yuan in total, but in the end she only paid 20.1 yuan. Little Keke was confused.
“The supermarket gives students a discount, it’s 15% off in the end.”
“But it can’t be this price, right? Let me think... it should be 20.145 yuan.”
“When the supermarket settles the bill, it will round down in terms of jiao. That is, the smallest unit for payment is 0.1 yuan, and any extra amount less than 0.1 yuan is discarded.”
Description
Now, suppose Little Keke buys a total of $n$ types of goods. The unit price of the $i$-th type is $a_i$ yuan, and he buys $b_i$ items. In the end, a 15% discount (85% of the original price) is applied, and any remaining amount less than one jiao is discarded. Can you help him compute the actual amount of money he needs to pay?
Input Format
The first line contains a positive integer $n$, representing the number of types of goods.
The next $n$ lines each contain a **two-decimal number $a_i$** and an integer $b_i$, separated by a space, representing the unit price and the quantity purchased for the $i$-th type. **Note that the trailing zeros after the decimal point will not be omitted in the input.**
Output Format
Output only one line: a **one-decimal number**, representing the actual amount of yuan Little Keke needs to pay after the discount and discarding the fractional part smaller than one jiao. **Note that even if the digit after the decimal point is 0, you must still output it.**
Explanation/Hint
[Sample 1 Explanation]
This is the example in the [Background] section.
[Sample 2 Explanation]
Little Keke’s original total is $3.00 \times 2 + 17.95 \times 1 + 0.10 \times 1 = 24.05$ yuan. After the 15% discount, it becomes $24.05 \times 85\% = 20.4425$ yuan. After discarding the extra fractional part, it becomes $20.4$ yuan.
[Constraints and Notes]
**Hint: If you are not familiar with floating-point numbers, try to use integers as much as possible.**
- For $30\%$ of the testdata, it is guaranteed that $n=1$.
- For another $30\%$ of the testdata, it is guaranteed that the answer is an exact multiple of one jiao.
- For $100\%$ of the testdata, it is guaranteed that $1 \le n \le 10$, $0.01 \le a_i \le 99.99$, $1 \le b_i \le 10$.
Translated by ChatGPT 5