(1).백준 16099번 Larger Sport Facility는 더 넓은 장소를 출력해야 하는 간단한 문제로

각각 a,b,x,y로 구분해서 각 사각형의 넓이를 구하려고 했지만

각 숫자별로 10억까지의 제한이라 Number로는 에러가 날 것 같아서 BigInt로 처리했다.

 

다만 첫번째 형태로 보통 문제를 처리했었는데

런타임 에러가 발생해서 두번째와 같이 처리해야 했다.

const input = require('fs').readFileSync('/dev/stdin').toString().trim().split('\n').map(el => el.split(' ').map(Number))

const input = require('fs').readFileSync(0, 'utf-8').trim().split('\n').map(el => el.split(' ').map(BigInt))

const input = `2
3 2 4 2
536874368 268792221 598 1204`.split('\n').map(el => el.split(' ').map(BigInt))
const result = []

for(let i = 1 ; i < input.length ; i++){
    const [a, b, x, y] = input[i]
    if(a*b > x*y){
        result.push('TelecomParisTech')
    }
    else if(a*b < x*y){
        result.push('Eurecom')
    }
    else{
        result.push('Tie')
    }
}
console.log(result.join('\n'))

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

[개발일지] - 665  (0) 2025.04.29
[개발일지] - 664  (0) 2025.04.28
[개발일지] - 662(주말)  (0) 2025.04.26
[개발일지] - 661  (0) 2025.04.25
[개발일지] - 660  (0) 2025.04.24

+ Recent posts