문제
https://www.acmicpc.net/problem/7568
코드
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int N = in.nextInt();
int[][] people = new int[N][2];
int[] answer = new int[N];
for(int i=0; i<N; i++) {
people[i][0] = in.nextInt();
people[i][1] = in.nextInt();
}
for(int i=0; i<N; i++) {
int tmp = 0;
for(int j=0; j<N; j++) {
if(i!=j && people[i][0]<people[j][0] && people[i][1]<people[j][1]) {
tmp++;
}
}
answer[i] = tmp+1;
}
for(int i=0; i<N; i++) {
System.out.print(answer[i]);
if(i!=N-1)
System.out.print(" ");
else
System.out.println();
}
}
}
'Preparing Coding Test > Baekjoon' 카테고리의 다른 글
[Java/백준/스택] 10828 - 스택 (0) | 2020.09.03 |
---|---|
[Java/백준/문자열, 스택] 9935 - 문자열 폭발 (0) | 2020.08.28 |
[Java/백준/브루트 포스] 2231 - 분해합 (0) | 2020.08.26 |
[Java/백준/브루트 포스] 2798 - 블랙잭 (0) | 2020.08.26 |
[Java/백준/정렬] 2108 - 통계학 (0) | 2020.08.24 |