eolymp
bolt
Try our new interface for solving problems
Problems

Discounts

published at 10/10/22, 9:40:36 am

SALAM SABAHINIZ XEYIR

published at 7/22/23, 10:32:29 am

dostum azer mende ele yazdim olmadi 37 faiz verdi sendede

published at 4/23/24, 8:38:42 pm

include <bits/stdc++.h>

using namespace std;

int main()

{

int n, m[10000], temp;
long long Sum = 0;
cin >> n;
for (int i = 0; i < n; i++) cin >> m[i];
for (int i = 0; i < n - 1; i++)
    for (int j = i + 1; j < n; j++)
        if (m[i] < m[j])
        {
            temp = m[i];
            m[i] = m[j];
            m[j] = temp;
        }
for (int i = 0; i < n - n % 3; i++) if ((i + 1) % 3) Sum += m[i];
for (int i = n - n % 3; i < n; i++) Sum += m[i];
cout << Sum << endl;

}