码迷,mamicode.com
首页 > 其他好文 > 详细

HDU 5999: The Third Cup is Free

时间:2017-08-17 00:46:40      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:show   case   bbb   namespace   bit   clu   short   c++   ++   


///@link http://acm.hdu.edu.cn/showproblem.php?pid=5999
///@author Sycamore
///@date Aug, 16
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int T;
cin>>T;
for(int t=1;t<=T;t++)
{
int n;
cin>>n;
vector<unsigned short>p(n);
for(auto &e:p)cin>>e;
sort(p.begin(),p.end());
int ans=0;
for(int i=n-1;i>=0;i-=3)
ans+=p[i];
for(int i=n-2;i>=0;i-=3)
ans+=p[i];
cout<<"Case #"<<t<<": "<<ans<<\n;
}
return 0;
}

HDU 5999: The Third Cup is Free

标签:show   case   bbb   namespace   bit   clu   short   c++   ++   

原文地址:http://www.cnblogs.com/zjnu/p/7376501.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!