반응형
Notice
Recent Posts
Recent Comments
Link
불로구
백준 7568 (JAVA) - 덩치 본문
반응형
package 브루트포스;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;
public class 덩치 {
static StringBuilder sb = new StringBuilder();
static StringTokenizer st;
static int[][] arr;
static int N;
public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
N = Integer.parseInt(br.readLine());
arr = new int[N][2];
for(int i=0; i<N; i++) {
st = new StringTokenizer(br.readLine(), " ");
int x = Integer.parseInt(st.nextToken());
int y = Integer.parseInt(st.nextToken());
arr[i][0] = x;
arr[i][1] = y;
}
solution();
}
static void solution() {
for(int i=0; i<N; i++) {
int rank = 1;
for(int j=0; j<N; j++) {
if(i == j ) continue;
if(arr[i][0] < arr[j][0] && arr[i][1] < arr[j][1]) {
rank++;
}
}
sb.append(rank + " ");
}
System.out.println(sb.toString());
}
}
반응형
'코딩테스트 > 백준' 카테고리의 다른 글
백준 2231(JAVA) - 분해합 (0) | 2021.03.06 |
---|---|
백준 2798 (JAVA) - 블랙잭 (0) | 2021.03.06 |
[백준 - 10816 ] - 숫자카드2( JAVA ) (0) | 2021.02.11 |
[백준 - 1920 ] - 수찾기 ( JAVA ) (0) | 2021.02.11 |
Comments