✨ Algorithm/백준

[알고리즘] 백준 14681번 사분면 고르기 (자바|Java)

엉ㅇㅏ 2022. 12. 9. 23:54

1. 문제

사진에 해당 사이트 링크 연결

 

2. 풀이

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        if(sc.nextInt() > 0) {
            if(sc.nextInt() > 0) {
                System.out.println("1");
            } else {
                System.out.println("4");
            }
        } else {
            if (sc.nextInt() > 0) {
                System.out.println("2");
            } else {
                System.out.println("3");
            }
        }
        sc.close();
    }
}