Algorithm
- μ§μ¬κ°νμμ νμΆ -
λ¬Έμ
νμλ μ§κΈ (x, y)μ μλ€. μ§μ¬κ°νμ κ° λ³μ΄ μ’νμΆμ νννκ³ , μΌμͺ½ μλ κΌμ§μ μ (0, 0), μ€λ₯Έμͺ½ μ κΌμ§μ μ (w, h)μ μλ€. μ§μ¬κ°νμ κ²½κ³μ κΉμ§ κ°λ 거리μ μ΅μκ°μ ꡬνλ νλ‘κ·Έλ¨μ μμ±νμμ€.
μ μΆλ ₯ μμ
λ¬Έμ νκΈ°
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input;
rl.on("line", function (line) {
input = line
.toString()
.split(" ")
.map((el) => +el);
}).on("close", function () {
let value = [input[0], input[1], input[2] - input[0], input[3] - input[1]];
console.log(Math.min.apply(null, value));
process.exit();
});
λ°μν
'κ°μΈκ³΅λΆ > Algorithm' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[λ°±μ€][Node.js] 1431λ² : μλ¦¬μΌ λ²νΈ (0) | 2021.07.01 |
---|---|
[λ°±μ€][Node.js] 1427λ² : μνΈμΈμ¬μ΄λ (0) | 2021.06.30 |
[λ°±μ€][Node.js] 1057λ² : ν λλ¨ΌνΈ (0) | 2021.06.28 |
[λ°±μ€][Node.js] 1037λ² : μ½μ (0) | 2021.06.27 |
[λ°±μ€][Node.js] 1026λ² : 보물 (0) | 2021.06.26 |
λκΈ