사분면 고르기 (14681)

유지원·2021년 6월 16일
0

백준OJ

목록 보기
15/32
post-thumbnail

Java 11

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int x = Integer.parseInt(br.readLine());
        int y = Integer.parseInt(br.readLine());
        br.close();

        StringBuilder sb = new StringBuilder();

        if (x > 0 && y > 0) {
            sb.append("1");
        }
        else if (x < 0 && y > 0) {
            sb.append("2");
        }
        else if (x < 0 && y < 0) {
            sb.append("3");
        }
        else {
            sb.append("4");
        }

        System.out.print(sb);

    }
}
profile
👋 https://github.com/ujw0712

0개의 댓글