본문 바로가기

JAVA-BAEKJOON/2단계 조건문

[백준/02-04] 14681 사분면 고르기

NO.14681 

 

풀이코드

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int x = sc.nextInt();
		int y = sc.nextInt();
		
		if(x>0) {
			if(y>0) {
				System.out.println(1);
			} else
				System.out.println(4);
		} else {
			if(y>0) {
				System.out.println(2);
			} else{
			    System.out.println(3);
			}
		}
}
}

 

📌 아직 코드가 짧고 숫자형들이라 그런가 scanner 가 작성하기 너무 편하다.. 편식하면 안되는데..
      일단 할 게 많으니까 급한거 먼저 하고 자투리시간에 bufferedReader 도 해봐야겠다.