Notice
Recent Posts
Recent Comments
Link
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

전공공부

[BOJ 7568] 덩치 본문

Study/Problem Solving

[BOJ 7568] 덩치

monitor 2023. 8. 20. 15:39

단순 구현 문제였다.

import java.util.*;
import java.io.*;
public class BOJ_7568 {
    static class Data {
        int weight;
        int height;
        public Data(int x, int y){
            this.weight = x;
            this.height = y;
        }
    }
    public static void main(String[] args) throws Exception{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer tk = new StringTokenizer(in.readLine()," ");
        int N = Integer.parseInt(tk.nextToken());
        Stack<Data> st = new Stack<>();
        List<Data> list = new ArrayList<>();
        for(int i = 0; i < N; i++){
            tk = new StringTokenizer(in.readLine()," ");
            list.add(new Data(Integer.parseInt(tk.nextToken()),Integer.parseInt(tk.nextToken())));
        }
        int ans = 1;
        for(int j = 0; j < N; j++) {
            for (int i = 0; i < N; i++) {
                if(i == j){
                    continue;
                }
                if ((list.get(j).height < list.get(i).height && list.get(j).weight < list.get(i).weight)) {
                    ans++;
                }
            }
            System.out.print(ans + " ");
            ans = 1;
        }
    }
}
 

7568번: 덩치

우리는 사람의 덩치를 키와 몸무게, 이 두 개의 값으로 표현하여 그 등수를 매겨보려고 한다. 어떤 사람의 몸무게가 x kg이고 키가 y cm라면 이 사람의 덩치는 (x, y)로 표시된다. 두 사람 A 와 B의 덩

www.acmicpc.net

'Study > Problem Solving' 카테고리의 다른 글

[BOJ_1446] 지름길  (0) 2023.08.27
[BOJ 15989] 1,2,3 더하기4  (0) 2023.08.26
[BOJ 11286] 절대값 힙  (0) 2023.08.13
[BOJ 2606] 바이러스  (0) 2023.08.12
[BOJ 8979] 올림픽  (0) 2023.07.30