QOJ.ac

QOJ

時間限制: 4 s 記憶體限制: 256 MB 總分: 100

#11332. 第三杯免费

统计

Panda 和他的朋友们正在森林里徒步旅行。他们偶然发现了一个位于巨大树干内的咖啡吧。

Panda 决定请大家喝杯咖啡并休息一下。调酒师 Buck 先生用他的鹿角向 Panda 和他的动物朋友们致意。他自豪地告诉他们,他的咖啡是森林里最好的,而且这家店是一家米其林星级酒吧,这就是为什么这家店被称为 Starred Bucks。

咖啡吧正在进行一项促销活动:每购买 3 杯咖啡,其中最便宜的一杯免费。在询问了所有朋友喜欢的口味后,Panda 想知道他总共需要支付多少钱。

输入格式

输入的第一行包含测试用例的数量 $T$。

接下来是 $T$ 个测试用例。每个测试用例包含两行。第一行包含一个整数 $N$,表示要购买的咖啡杯数。

第二行包含 $N$ 个整数 $p_1, p_2, \dots, p_N$,表示每一杯咖啡的价格。

输出格式

对于每个测试用例,输出一行 “Case #x: y”,其中 $x$ 是测试用例编号(从 1 开始),$y$ 是 Panda 需要支付的最少金额。

数据范围

  • $1 \le T \le 100$
  • $1 \le N \le 10^5$
  • $1 \le p_i \le 1000$

样例

样例输入 1

2
3
1 2 3
5
10 20 30 20 20

样例输出 1

Case #1: 5
Case #2: 80

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.