본문 바로가기

카테고리 없음

[BAEKJOON] 직사각형에서 탈출 (1085번)

// const input  = require("fs").readFileSync("/dev/stdin").toString().trim().split(" ");
const input  = "6 2 10 3".toString().trim().split(" ");

function chess(input) {
    let x = Number(input[0]);
    let y = Number(input[1]);
    let w = Number(input[2]);
    let h = Number(input[3]);
    let arr = [x, y, w - x, h -y];

    console.log(Math.min.apply(null, arr));
}

chess(input);