#P834. Quadrant Selection

Quadrant Selection

題目描述

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).

Samples

["12\r\n5","9\r\n-13"]
["1","4"]

原始資料

  • Zero1 題號:a834
  • Hydro 題號:Z0834
  • Locale:zh_TW
  • Display:open