7568번: 덩치
우리는 사람의 덩치를 키와 몸무게, 이 두 개의 값으로 표현하여 그 등수를 매겨보려고 한다. 어떤 사람의 몸무게가 x kg이고 키가 y cm라면 이 사람의 덩치는 (x,y)로 표시된다. 두 사람 A 와 B의 덩�
www.acmicpc.net
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
struct person{
int weight;
int height;
int order;
};
int main() {
int input = 0;
cin >> input;
person people[input];
for(int i=0; i<input; i++){
cin >> people[i].weight >> people[i].height;
people[i].order = 0;
}
int count = 0;
for(int i = 0; i<input; i++){
for(int j = 0; j<input; j++){
if(people[i].weight < people[j].weight && people[i].height < people[j].height){
count++;
}
}
people[i].order = count+1;
count = 0;
}
for(int i=0; i<input; i++){
cout << people[i].order << " ";
}
}
'알고리즘 문제풀이 > 백준' 카테고리의 다른 글
백준2309번 - 일곱 난쟁이 (0) | 2020.08.14 |
---|---|
백준 1316번 - 그룹단어 체커 (0) | 2020.07.30 |
백준 1436번 - 영화감독 숌 (0) | 2020.07.30 |
백준 5622번 - 다이얼 (0) | 2020.07.29 |
백준 1181번 - 단어정렬 (0) | 2020.07.24 |