QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 256 MB 満点: 100

#4441. BIT 地铁

統計

BIT(北京国际交通)地铁是 2050 年最流行的出行方式,它能让人们在短时间内到达任何地方。某天,BIT 地铁推出了如下优惠活动: - 如果你本月累计消费的票价 $x$ 大于或等于 100,那么购买下一张票价为 $y$ 的票时,你只需要支付 $0.8y$。 - 如果你本月累计消费的票价 $x$ 大于或等于 200,那么购买下一张票价为 $y$ 的票时,你只需要支付 $0.5y$。

DLee 很高兴他能省下更多的钱来买房。然而,很久之后,他发现实际的计费方式和他想的有点不同。例如,DLee 本月已经花费了 199 元,现在他买了一张 10 元的票,然后又买了一张 8 元的票: - DLee 认为他可以一次只买票的一部分,而不是整张票。也就是说,对于 10 元的票,DLee 认为他可以先买 1.25 元的部分,然后再买 8.75 元的部分。在他的误解下,他需要花费 $199 + 1.25 * 0.8 + 8.75 * 0.5 + 8 * 0.5 = 208.375$ 元。注意,在这个例子中,DLee 必须花费 1.25 元而不是 1 元来使 $x = 200$。 - 实际的计费方式是:只有当你已经消费足够时,才能获得折扣,因此实际花费为 $199 + 10 * 0.8 + 8 * 0.5 = 211$ 元。

现在 DLee 想知道在过去的几个月里,这两种计费方式造成的差额是多少。

输入格式

每个测试包含多个测试用例。第一行包含一个整数 $T(1 \le T \le 10)$,表示 DLee 想要检查的月份数。接下来是各个月份的描述。 每个月份的第一行包含一个整数 $n(1 \le n \le 10^5)$,表示 DLee 在该月购买的票数。 接下来一行包含 $n$ 个整数 $a_1, a_2, \dots, a_n(1 \le a_i \le 200)$,$a_i$ 表示第 $i$ 张票的价格。

输出格式

对于每个月,输出一行,包含两个数字,用空格隔开,保留三位小数。第一个数字表示 DLee 设想的费用,第二个数字表示实际费用。

样例

输入 1

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

输出 1

110.400 111.400
213.000 216.900
196.000 215.000

说明

对于第一个样例,DLee 认为的费用是:$20 + 20 + 20 + 20 + 18 + 2 + ((7 - 2) + 8) * 0.8 = 110.4$,实际费用是:$20 + 20 + 20 + 20 + 18 + 7 + 8 * 0.8 = 111.4$。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.