SAC '22 Code Challenge 3 Junior P2 - Normal Lines

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 1.0s
Memory limit: 256M

Authors:
Problem type

Leo Zhuang, who just graduated elementary school, is working hard as always. This time, he has encountered a graphing problem:

Given a line segment from (x1,y1) to (x2,y2), determine if the segment is parallel to either the x-axis or the y-axis.

If it is parallel to the x-axis, output x-axis; if it is parallel to the y-axis, output y-axis; if it is parallel to neither axis, output neither.

Can you determine this for him?

Constraints

109x1,y1,x2,y2109

Note that the coordinates of the points will not be identical.

Input Specification

The first line will contain the integer coordinates of the first point, x1 and y1, respectively.

The second line will contain the integer coordinates of the second point, x2 and y2, respectively.

Output Specification

Answer Leo's question: if it is parallel to the x-axis, output x-axis; if it is parallel to the y-axis, output y-axis; if it is parallel to neither axis, output neither.

Sample Input 1

Copy
7 -2
-3 -2

Sample Output 1

Copy
x-axis

Sample Input 2

Copy
-5 5
-5 10

Sample Output 2

Copy
y-axis

Sample Input 3

Copy
3 3
-3 -3

Sample Output 3

Copy
neither

Comments

There are no comments at the moment.