#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
int n;
cin>>n;
int a[n];
int zbir=0;
for(int i=0; i < n;i++){cin >>a[i];zbir+=a[i];}
sort(a,a+n);
reverse(a,a+n);
//for(int i=0;i <n;i++)cout<<a[i]<<"\n";
for(int i=0; i < n; i++){
if((i+1)%3==0){
zbir-=a[i];
}
}
cout<<zbir;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
412 KB |
Output is correct |
6 |
Correct |
20 ms |
1584 KB |
Output is correct |
7 |
Correct |
15 ms |
1372 KB |
Output is correct |
8 |
Correct |
16 ms |
1368 KB |
Output is correct |
9 |
Correct |
28 ms |
1628 KB |
Output is correct |
10 |
Correct |
25 ms |
1624 KB |
Output is correct |