https://www.acmicpc.net/problem/10814
const fs = require('fs');
let input = fs.readFileSync('/dev/stdin').toString().split("\n");
const N = Number(input[0]);
let arr = [];
for(let i = 1 ;i <= N ; i++) {
const [ age, name ] = input[i].split(' ');
arr.push([Number(age), name]);
}
arr.sort(function(a,b) {
if(a[0] > b[0]) return 1;
else if(a[0] < b[0]) return -1;
else return 0;
})
arr = arr.map((a) => a[0]+" "+a[1]);
console.log(arr.join('\n'));
728x90
'Algorithm&CodingTest > Baekjoon' 카테고리의 다른 글
[ Baekjoon ] [2607] 실버 3 - 비슷한 단어 (1) | 2023.03.12 |
---|---|
[ Baekjoon ] [13305] 실버 3 - 주유소 (0) | 2023.03.12 |
[Baekjoon] [2839] 설탕 배달 (0) | 2023.02.24 |
[Baekjoon] [1978] 실버4 - 소수찾기 (0) | 2023.02.24 |
[Baekjoon] [2754] 학점 계산 (0) | 2023.02.24 |