https://www.acmicpc.net/problem/18110
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
int main(void) {
// C++ Init
ios::sync_with_stdio(false);
cin.tie(NULL);
int input1, input2;
int exp;
int sum = 0;
int score;
vector<int> v;
cin >> input1;
if (input1 == 0) {
cout << 0 << endl;
return 0;
}
exp = round(input1 * 0.15);
for (int i = 0; i < input1; i++) {
cin >> input2;
v.push_back(input2);
}
sort(v.begin(), v.end());
v.erase(v.begin(), v.begin() + exp);
v.erase(v.end() - exp, v.end());
for (int i = 0; i < v.size(); i++) {
sum += v[i];
}
score = round(sum / double(v.size()));
cout << score;
}
'알고리즘' 카테고리의 다른 글
C++ 알고리즘 - 백준 10816 숫자 카드 2 (unordered_map) (0) | 2025.01.01 |
---|---|
C++ 알고리즘 - 백준 1929 소수 구하기 (에라토스테네스의 체) (0) | 2024.12.31 |
C++ 알고리즘 - 백준 11866 요세푸스 문제 0 (0) | 2024.12.31 |
C++ 알고리즘 - 백준 10845 큐 (0) | 2024.12.31 |
C++ 알고리즘 - 백준 10828 스택 (0) | 2024.12.31 |