[백준 알고리즘] - #14681 사분면 고르기

Sean yang~~·2022년 8월 11일
0

알고리즘

목록 보기
16/16
post-thumbnail

예제 입력 1
12
5

예제 출력 1
1

const readline = require("readline");
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

let input = [];

rl.on("line", function (line) {
  input.push(parseInt(line));
}).on("close", function () {
  ///////////////////////////////
  const x = input[0];
  const y = input[1];

  if (x > 0 && y > 0) {
    console.log(1);
  } else if (x < 0 && y > 0) {
    console.log(2);
  } else if (x < 0 && y < 0) {
    console.log(3);
  } else if (x > 0 && y < 0) {
    console.log(4);
  }
  /////////////////////////////
  process.exit();
});
profile
나는 프론트엔드 개발자다!

0개의 댓글