Coding Test/백준
[백준 14681번 - java] 사분면 고르기
olli2
2021. 11. 3. 14:59
https://www.acmicpc.net/problem/14681
내 답안
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
Scanner s = new Scanner(System.in);
int a = s.nextInt();
int b = s.nextInt();
if (a>0 && b>0) {
System.out.println("1");
}
else if (a>0 && b<0) {
System.out.println("4");
}
else if (a<0 && b>0) {
System.out.println("2");
}
else System.out.println("3");
}
}