728x90
반응형
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
class Person{
int w,h,rank;
Person(int weight,int height){
this.w = weight;
this.h = height;
}
}
public class Main {
static int [][] dp = new int[15][15];
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int tc = Integer.parseInt(br.readLine());
Person[] people = new Person[tc];
for (int i = 0; i < tc; i++) {
StringTokenizer st = new StringTokenizer(br.readLine()," ");
int weight = Integer.parseInt(st.nextToken());
int height = Integer.parseInt(st.nextToken());
people[i] = new Person(weight,height);
}
for (int i = 0; i < tc; i++) {
int rank = 1;
Person a = people[i];
for (int j = 0; j < tc; j++) {
if(i==j) continue;
Person b = people[j];
if(a.w < b.w && a.h < b.h){
rank++;
}
}
System.out.print(rank+" ");
}
}
}
728x90
반응형
'알고리즘 > 일반(단순구현)' 카테고리의 다른 글
[백준] 1065번 한수 #Java (0) | 2022.05.31 |
---|---|
[백준] 17478번 재귀함수가 뭔가요? #Java (0) | 2022.05.17 |
[백준] 2292번 벌집 #Java (0) | 2022.05.07 |
[백준] 2869번 달팽이는 올라가고 싶다 #Java (0) | 2022.05.07 |
[백준] 10250번 ACM 호텔 #Java (0) | 2022.05.07 |