-
[백준] 7568 덩치ALGORITHM/BOJ 2022. 2. 2. 22:51
https://www.acmicpc.net/problem/7568
2022-02-02
1234567891011121314151617181920212223242526272829303132333435363738import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.Arrays;import java.util.Comparator;import java.util.StringTokenizer;public class Main {public static int N;public static int[][] arr;public static void main(String[] args) throws IOException {BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));StringTokenizer st = new StringTokenizer(bf.readLine().trim());N = Integer.parseInt(st.nextToken());arr = new int[N][2];for(int i = 0; i < N; i++) {st = new StringTokenizer(bf.readLine());int x = Integer.parseInt(st.nextToken());int y = Integer.parseInt(st.nextToken());arr[i][0] = x;arr[i][1] = y;}StringBuilder sb = new StringBuilder();for(int i = 0; i < N; i++) {int cnt = 1;for(int j = 0; j < N; j++) {if(i == j) continue;if(arr[i][1] < arr[j][1] && arr[i][0] < arr[j][0]) cnt++;}sb.append(cnt).append(" ");}System.out.println(sb.toString());}}cs #문제풀이
브루트포스로 몸무게 키 모두 큰 갯수 카운팅
'ALGORITHM > BOJ' 카테고리의 다른 글
[백준] 1193 분수찾기 (0) 2022.02.06 [백준] 1339 단어 수학 (0) 2022.02.05 [백준] 4991 로봇 청소기 (0) 2021.12.11 [백준] 14716 현수막 (0) 2021.11.15 [백준]1316 그룹 단어 체커 (0) 2021.11.08