mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
2d9cf4fdf2
1600-1699
24 lines
446 B
C++
24 lines
446 B
C++
#include<stdio.h>
|
|
#include<algorithm>
|
|
using namespace std;
|
|
bool cmp(int x,int y)
|
|
{ return x>y;
|
|
}
|
|
int main()
|
|
{ int t,n,i,sum;
|
|
int a[20005];
|
|
scanf("%d",&t);
|
|
while(t--)
|
|
{ scanf("%d",&n);sum=0;
|
|
for(i=1;i<=n;i++)
|
|
{ scanf("%d",&a[i]);
|
|
}
|
|
sort(a+1,a+n+1,cmp);
|
|
for(i=3;i<=n;i+=3)
|
|
{ sum+=a[i];
|
|
}
|
|
printf("%d\n",sum);
|
|
}
|
|
return 0;
|
|
}
|