Skip to content

Instantly share code, notes, and snippets.

@jinnatul
Created January 15, 2019 17:55
Show Gist options
  • Save jinnatul/9734e0aa912676adfa4b9c284df3b61f to your computer and use it in GitHub Desktop.
Save jinnatul/9734e0aa912676adfa4b9c284df3b61f to your computer and use it in GitHub Desktop.
#include<bits/stdc++.h>
using namespace std;
/// Typedef
typedef long long ll;
#define sc1(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld %lld",&a,&b)
#define pf1(a) printf("%lld\n",a)
#define pf2(a,b) printf("%lld %lld\n",a,b)
#define mx 10000007
#define mod 100000007
#define PI acos(-1.0)
int dr[] = {-2,-2,-1,-1,1,1,2,2};
int dc[] = {-1,1,-2,2,-2,2,-1,1};
int main()
{
ll num, m, tc = 1;
// freopen("/media/morol/574830c2-aaf8-40d8-9a94-7a029a2e831f/coding/clion/p1/output.txt", "w", stdout);
sc1(tc);
while (tc--){
sc1(num);
ll arr[num];
for(ll i = 0; i < num; i++){
sc1(arr[i]);
}
sort(arr, arr + num, greater<ll>());
ll sum = 0;
for(ll i = 2; i < num; i+=3){
sum += arr[i];
}
pf1(sum);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment