Skip to content

Commit

Permalink
이슈 #381에서 솔루션 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Nov 21, 2024
1 parent 190435c commit 5781b9c
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Programmers/등수_매기기.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <string>
#include <vector>

using namespace std;

vector<int> solution(vector<vector<int>> score) {
int n = score.size();
vector<double> avg(n);
vector<int> ranks(n, 1);

for (int i = 0; i < n; i++) {
avg[i] = (score[i][0] + score[i][1]) / 2.0;
}

for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (avg[i] < avg[j]) {
ranks[i]++;
}
}
}

return ranks;
}

0 comments on commit 5781b9c

Please sign in to comment.