Quadrant Selection

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 62M

Author:
Problem type

In a Cartesian Plane, a grid is divided into 4 parts. Points on a Cartesian Plane can be represented with coordinates. Points in the top right quadrant of the plane have a positive x and positive y value. This quadrant is referred to as Quadrant 1. The properties of the quadrants are shown in the image below.

If you can't see the image just search it up

Your task is to determine which quadrant a point lies on, given its x and y coordinates.

Input Specification

The first line of input will contain x (-10^5 \le x \le 10^5).
The second line of input will contain y (-10^5 \le y \le 10^5).

Output Specification

Output the quadrant number the given point lies on.

Sample Input

5
-7

Sample Output

4

Comments


  • 0
    Samuel_Liu  commented on Oct. 24, 2019, 1:52 p.m.

    Wat if it's 0, 0?


    • 2
      jsumabat  commented on Oct. 24, 2019, 3:03 p.m.

      It will not be (0, 0)