#include <bits/stdc++.h>
using namespace std;
int n,sum;
int a[100000000];
int main()
{
cin>>n;
for (int i=1;i<=n;i++)
cin>>a[i];
sort (a+1,a+n+1);
reverse(a+1,a+n+1);
for (int i=1;i<=n;i++)
{
if (i%3)
sum+=a[i];
}
cout <<sum;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
28 ms |
1132 KB |
Output is correct |
7 |
Correct |
25 ms |
1132 KB |
Output is correct |
8 |
Correct |
24 ms |
1132 KB |
Output is correct |
9 |
Correct |
36 ms |
1388 KB |
Output is correct |
10 |
Correct |
36 ms |
1260 KB |
Output is correct |