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
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 the quadrant number (1, 2, 3 or 4) for the point (x, y).
12 5
1
9 -13
4
ID | User | Problem | Subject | Hit | Post Date |
沒有發現任何「解題報告」 |