BOJ 2562

슬기로운 FE 세상·2022년 3월 19일
0

const input = require('fs').readFileSync('./input.txt').toString().trim().split('\n');

let num;
let max = Number.MIN_SAFE_INTEGER;

for(let i=0; i<input.length; i++) {
    let a = Number(input[i].split(' '))
    if(a > max) {
        num = i+1;
        max = a;
    }
}

console.log(max);
console.log(num);

max 값을 Number.MIN_SAFE_INTEGER로 설정하고, a와 비교, num은 0부터 카운팅 되기 때문에 +1

profile
자 드가자~~

0개의 댓글

관련 채용 정보