問題
The x and y axes split the plane into four quadrants: Q1 (x > 0, y > 0), Q2 (x < 0, y > 0), Q3 (x < 0, y < 0) and Q4 (x > 0, y < 0). Points on an axis belong to no quadrant.
Implement point_quadrant(x, y).
Input
x: The x coordinate. y: The y coordinate.
Output
Return "Q1", "Q2", "Q3" or "Q4"; "X-axis" or "Y-axis" for points on an axis; or "Origin" for (0, 0).
制約
-1,000,000 ≤ x, y ≤ 1,000,000
例
例 1
入力:
x = -3
y = 4
期待される出力:
expected = "Q2"
入力:
long long x = -3;
long long y = 4;
期待される出力:
std::string expected = "Q2";
入力:
long x = -3;
long y = 4;
期待される出力:
string expected = "Q2";
解説
x is negative and y is positive, so the point is in Q2.
例 2
入力:
x = 5
y = 0
期待される出力:
expected = "X-axis"
入力:
long long x = 5;
long long y = 0;
期待される出力:
std::string expected = "X-axis";
入力:
long x = 5;
long y = 0;
期待される出力:
string expected = "X-axis";
解説
y is 0, so the point lies on the X-axis.
参考資料
この課題はCodeUtility用に調整されています。上記の説明と制約に従ってください。