a834: Quadrant Selection
Tags : if
Accepted rate : 29人/29人 ( 100% ) [非即時]
評分方式:
Tolerant

最近更新 : 2022-10-16 22:37

Content

A common problem in mathematics is to determine which quadrant a given point lies in. There are four quadrants, numbered from 1 to 4.For example, a point with coordinates (12, 5) lies in quadrant 1 since both its x and y values are positive, and a point with coordinates (-12,5) lies in quadrant 2 since its x value is negative and its y value is positive. Quadrant 3 has points where both x value and y value are negative and quadrant 4 has points where its x value is positive and its y value is negative.

Your job is to take a point and determine the quadrant it is in. You can assume that neither of the two coordinates will be 0

Input

The first line of input contains the integer x (−1000 ≤ x ≤ 1000; x != 0). The second line of input contains the integer y (−1000 ≤ y ≤ 1000; y != 0).

Output

Output the quadrant number (1, 2, 3 or 4) for the point (x, y).

Sample Input #1
12
5
Sample Output #1
1
Sample Input #2
9
-13
Sample Output #2
4
測資資訊:
記憶體限制: 64 MB
公開 測資點#0 (9%): 1.0s , <1K
公開 測資點#1 (9%): 0.9090909090909091s , <1K
公開 測資點#2 (9%): 0.9090909090909091s , <1K
公開 測資點#3 (9%): 0.9090909090909091s , <1K
公開 測資點#4 (9%): 0.9090909090909091s , <1K
公開 測資點#5 (9%): 0.9090909090909091s , <1K
公開 測資點#6 (9%): 0.9090909090909091s , <1K
公開 測資點#7 (9%): 0.9090909090909091s , <1K
公開 測資點#8 (9%): 0.9090909090909091s , <1K
公開 測資點#9 (9%): 0.9090909090909091s , <1K
公開 測資點#10 (10%): 0.9090909090909091s , <1K
Hint :
Tags:
if
出處:
CCC2017 [管理者:
issin@g.puic... (冼一心老師)
]


ID User Problem Subject Hit Post Date
沒有發現任何「解題報告」