Question: Adobe SheCodes, Online Assessment Questions | Get Maximum Cadies | 6th August 2023
0
Entering edit mode

ADD COMMENTlink 15 months ago PoGo 2.4k
0
Entering edit mode
#include<bits/stdc++.h>
using namespace std;
 
int main() {
    int n;cin >> n;
    vector<int> v(n); for(int i=0;i<n;i++) cin >> v[i];
    sort(v.begin(), v.end());
    int m=n/3;
    int sum=0;
    for(int i=m+1;i<=n;i+=2) {
        sum+=v[i-1];
    }
    cout << sum <<"\n";
    return 0;
}
ADD COMMENTlink 15 months ago sumeet kumar sahoo • 290

Login before adding your answer.

Similar Posts
Loading Similar Posts