코딩테스트/Lv1

[Python] 백준 온라인 저지 14681번

ggulgood 2022. 4. 12. 01:26

https://www.acmicpc.net/problem/14681

 

흔한 수학 문제 중 하나는 주어진 점이 어느 사분면에 속하는지 알아내는 것이다. 사분면은 아래 그림처럼 1부터 4까지 번호를 갖는다. "Quadrant n"은 "제n사분면"이라는 뜻이다.

 

정답

x = int(input())
y = int(input())

if (x > 0)and(y > 0):
    print('1')
elif (x > 0)and(y < 0):
    print('4')
elif (x < 0)and(y < 0):
    print('3')
elif (x < 0)and(y > 0):
    print('2')