首页 > 其他 > 详细

HDU 5999: The Third Cup is Free

时间:2017-08-16 23:48:38      阅读:308      评论:0      收藏:0      [点我收藏+]


///@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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!