(1).백준 11292번 키 큰 사람은

const input = `3
John 1.75
Mary 1.64
Sam 1.81
2
Jose 1.62
Miguel 1.58
5
John 1.75
Mary 1.75
Sam 1.74
Jose 1.75
Miguel 1.75
0`.split('\n')

const result = []

for(let i = 0 ; i < input.length ; i++){
    if(input[i] == '0'){
        break
    }
    const num = Number(input[i])
    const arr = input.slice(i + 1, i + num + 1).map(el => el.split(' '))
    let max = 0
    const strList = []
    for(let j = 0 ; j < arr.length ; j++){
        max = Math.max(max, arr[j][1])
    }
    console.log(max)
    
    for(let j = 0 ; j < arr.length ; j++){
        if(max == arr[j][1]){
            strList.push(arr[j][0])
        }
    }
    result.push(strList.join(' '))
    i+=num
    
}
console.log(result.join('\n'))

'회고' 카테고리의 다른 글

[개발일지] - 638  (0) 2025.04.01
[개발일지] - 637  (0) 2025.03.31
[개발일지] - 635(주말근무)  (0) 2025.03.29
[개발일지] - 634  (0) 2025.03.28
[개발일지] - 633  (0) 2025.03.27

+ Recent posts