#include<cstdio> #include<algorithm> using namespace std; int main() { int t,n,p[20005],dis; scanf("%d",&t); while (t--) { scanf("%d",&n); for (int i=0;i<n;i++) scanf("%d",&p[i]); sort(p,p+n); int i=n-1; dis=0; while (i>1) { dis+=p[i-2]; i-=3; } printf("%d\n",dis); } return 0; }
Sunday, July 17, 2016
Unknown
Studying at Shahjalal University of Science and Technology, Sylhet.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment