Pepperminttt
Pepperminttt's Dev
Pepperminttt
전체 방문자
오늘
어제
  • devInfo (86)
    • forBeingGoodDeveloper (2)
    • React (2)
      • LostArk Open API (1)
    • algorithm (58)
      • problems (44)
      • theory (14)
    • computerScience (8)
      • network (8)
    • javaScript (8)
    • Java (4)
    • web (2)
      • webApplication (2)
    • etc. (1)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • dfs
  • 프로그래머스
  • greedy
  • Network
  • dfs문제
  • Java
  • bfs문제
  • 벨만-포드
  • C++
  • 탐욕법
  • 탐욕법 문제
  • DP
  • BFS
  • node.js
  • 백준
  • 그래프
  • JavaScript
  • solved.ac
  • DP문제
  • 알고리즘

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
Pepperminttt

Pepperminttt's Dev

[백준] 6568번 덩치 _ Node
algorithm/problems

[백준] 6568번 덩치 _ Node

2022. 11. 16. 18:18

문제

https://www.acmicpc.net/problem/7568

 

7568번: 덩치

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

www.acmicpc.net


문제 풀이

 해당 문제의 입력의 최대 개수는 50이다. 즉 브루트 포스로 간단하게 풀이하였다.

 

const fs = require('fs');
const stdin = (process.platform === 'linux'? fs.readFileSync('/dev/stdin').toString() :
``).split('\n');

const input = (() => {
    let line = 0;
    return () => stdin[line++];
})();

const n = Number(input());
let answer = Array(n).fill(0);
let people = [];

for(let i = 0; i < n; i++)  people.push(input().split(' ').map(Number).concat(i))

for(let i = 0; i < n; i++){
    let rank = 1;
    for(let j = 0; j < n; j++){
        if(i === j) continue;
        if(people[i][0] < people[j][0] && people[i][1] < people[j][1])  rank++;
    }
    answer[i] = rank;
}
console.log(answer.join(' ').trim());

 

'algorithm > problems' 카테고리의 다른 글

[백준] 1003번 피보나치 함수 _ Node.js  (0) 2022.11.20
[백준] 18111번 마인크래프트 _ Node.js  (0) 2022.11.19
[백준] 2805번 나무 자르기 _ Node.js  (0) 2022.11.15
[백준] 1261번 알고스팟_Node.js  (0) 2022.11.14
[백준] 14225번 부분수열의 합 _ Node.js  (0) 2022.11.13
    'algorithm/problems' 카테고리의 다른 글
    • [백준] 1003번 피보나치 함수 _ Node.js
    • [백준] 18111번 마인크래프트 _ Node.js
    • [백준] 2805번 나무 자르기 _ Node.js
    • [백준] 1261번 알고스팟_Node.js
    Pepperminttt
    Pepperminttt
    HTML, JavaScript, Python 등 Computer language TIL

    티스토리툴바