-->
当前位置:首页 > 题库

PROGRAMMING:Judge the range of coordinate points

Luz5年前 (2021-05-10)题库387
Enter the value of a coordinate point (x, y) from the keyboard to judge whether the coordinate point is in the rectangle with origin (0,0), length of 10 and width of 5. The location of the rectangle is shown in the figure below.
![ Judge whether the coordinate point is in the rectangle. JPG] (~ / da386706-88ce-4868-8d6b-3d354c2e6286. JPG)
Please write a program to input the abscissa and ordinate values of a coordinate point from the keyboard and output the judgment results.
###Input format:
Enter two numbers (real numbers) on a line, separated by one or more spaces or carriage returns
###Output format:
(1) If the coordinate is within the rectangle (including the boundary), output "in the rectangle"
(2) If the coordinate is not in the rectangle (outside the boundary), output "not in the rectangle"
###Input sample 1:
Here is a set of inputs. For example:
```in
2 2
```
###Output sample 1:
The corresponding output is given here. For example:
```out
In the rectangle
```
###Input sample 2:
Here is a set of inputs. For example:
```in
6 4.0
```
###Output sample 2:
The corresponding output is given here. For example:
```out
Not in the rectangle
```







answer:If there is no answer, please comment
Hint:
A point is in the rectangle if its horizontal distance to (0, 0) is less than or equal to 10.0 / 2 and its vertical distance to (0, 0) is less than or equal to 5.0 / 2.