当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7179:BIT Subway

题目描述
BIT(Beijing International Transport) subway, which can take people anywhere in a short time, is the most popular travel mode in 2050. One day, BIT subway launches a promotion as follows:

- If the total ticket price $x$ you have spent this month is greater than or equal to 100 and you buy another ticket with ¥$y$, then you only need to pay ¥$0.8y$.
- If the total ticket price $x$ you have spent this month is greater than or equal to 200 and you buy another ticket with ¥$y$, then you only need to pay ¥$0.5y$.

DLee is so happy that he can save more money to buy a house. However, a long time later, he notices that the real billing method is a bit different from what he thought. For example, DLee has spent ¥199 on tickets this month, he now buys a ¥10 ticket, then buys an ¥8 ticket:

- DLee thinks that he can buy only a part of the ticket instead of the whole ticket at a time. That is, for the ¥10 ticket, DLee thinks he can buy the ¥1.25 part of the ticket first and buy the ¥8.75 part of the ticket then. Under his misunderstanding, he needs to spend $199+1.25\*0.8+8.75\*0.5+8\*0.5=$¥$208.375$. Note that in this example, DLee has to spend ¥1.25 instead of only ¥1 to make $x=200$.
- The real billing method is that only if you have spent enough, you can get the discount, so it will be $199+10\*0.8+8\*0.5=¥211$.

Now DLee wants to know in the previous months, how much difference did the billing method make.
输入解释
Each test contains multiple test cases. The first line contains one integer $T(1\leq T\leq 10)$, which means the months DLee wants to check. Description of the months follows.

The first line contains a single integer $n(1\leq n \leq 10^5)$, which means the number of tickets DLee bought in this month.

Then follows $n$ integers $a_1,a_2,\ldots,a_n(1 \leq a_i \leq 200)$, $a_i$ means the $i$-th ticket's price.
输出解释
For each month, output one line with two numbers divided by a single whitespace with three decimal places. The first number represents the cost in DLee's thought, and the second number represents the real cost.
输入样例
3
7
20 20 20 20 18 7 8
13
30 20 23 20 7 20 11 12 30 20 30 15 13
3
10 200 10
输出样例
110.400 111.400
213.000 216.900
196.000 215.000
来自杭电HDUOJ的附加信息
Hint For the first case, DLee thinks the cost is: $20+20+20+20+18+2+((7-2)+8)\*0.8=¥110.4$, the real cost is: $20+20+20+20+18+7+8\*0.8=¥111.4$

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7179

最后修改于 2022-09-15T06:17:11+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 262144/262144K(Java/Others)