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

建议使用的浏览器:

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

5999:The Third Cup is Free

题目描述
Panda and his friends were hiking in the forest. They came across a coffee bar inside a giant tree trunk.
Panda decided to treat everyone a cup of coffee and have some rest. Mr. Buck, the bartender greeted Panda and his animal friends with his antler. He proudly told them that his coffee is the best in the forest and this bar is a Michelin-starred bar, thats why the bar is called Starred Bucks.
There was a campaign running at the coffee bar: for every 3 cups of coffee, the cheapest one is FREE. After asking all his friends for their flavors, Panda wondered how much he need to pay.
输入解释
The first line of the input gives the number of test cases, T.
T test cases follow. Each test case consists of two lines. The first line contains one integer N, the number of cups to be bought.
The second line contains N integers $p_1, p_2, · · · , p_N$ representing the prices of each cup of coffee.
输出解释
For each test case, output one line containing “Case #x: y”, where x is the test case number (starting from 1) and y is the least amount of money Panda need to pay.

limits


$\bullet$ 1 ≤ T ≤ 100.
$\bullet$ 1 ≤ N ≤ $10^5$.
$\bullet$ 1 ≤ pi ≤ 1000.

输入样例
2
3
1 2 3
5
10 20 30 20 20
输出样例
Case #1: 5
Case #2: 80
来自杭电HDUOJ的附加信息
Recommend jiangzijing2015

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

题目来源 2016 CCPC-Final

源链接: HDU-5999

最后修改于 2020-10-25T23:27:24+00:00 由爬虫自动更新

共提交 7

通过率 14.29%
时间上限 内存上限
12000/6000MS(Java/Others) 32768/32768K(Java/Others)