개발 노트/백준, 프로그래머스 풀이
[백준 7568/c++] 덩치
tokkiC
2022. 7. 23. 22:56
데이터를 pair로 받아 두가지 조건을 비교하는 문제였다
https://www.acmicpc.net/problem/7568
7568번: 덩치
우리는 사람의 덩치를 키와 몸무게, 이 두 개의 값으로 표현하여 그 등수를 매겨보려고 한다. 어떤 사람의 몸무게가 x kg이고 키가 y cm라면 이 사람의 덩치는 (x, y)로 표시된다. 두 사람 A 와 B의 덩
www.acmicpc.net
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
pair<int, int> pr[54];
int rank = 1;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> pr[i].first >> pr[i].second;
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
if ((pr[i].first < pr[j].first) && (pr[i].second < pr[j].second))
{
rank++;
}
}
cout << rank << " ";
rank = 1;
}
return 0;
}