<문제 풀이>
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 && y > 0) {
System.out.print(1);
} else if (x < 0 && y > 0) {
System.out.print(2);
} else if (x < 0 && y < 0) {
System.out.print(3);
} else {
System.out.print(4);
}
}
}
이번 문제는 딱히 어렵지 않았다.. 문제 조건의 설명이 너무 잘 돼있었기 때문에 천천히 읽으면서 조건을 적으면 되는 문제였다!
'자바' 카테고리의 다른 글
백준 알고리즘 - 2753번 윤년 [자바] (0) | 2023.06.26 |
---|---|
백준 알고리즘 - 9498번 시험 성적 [자바] (0) | 2023.06.26 |
백준 알고리즘 - 1330번 두 수 비교하기 [자바] (0) | 2023.06.26 |
백준 알고리즘 - 10172번 개 [자바] (4) | 2023.06.23 |
백준 알고리즘 - 10171번 고양이 [자바] (0) | 2023.06.23 |