4434: Rectangle and Circle
金币值:2
定数:1
时间限制:1.000 s
内存限制:33 M
正确:0
提交:0
正确率:0.00% 命题人:
题目描述
Given a rectangle and a circle in the coordinate system(two edges of the rectangle are parallel with the X-axis, and the other two are parallel with the Y-axis), you have to tell if their borders intersect.
Note: we call them intersect even if they are just tangent. The circle is located by its centre and radius, and the rectangle is located by one of its diagonal.

Note: we call them intersect even if they are just tangent. The circle is located by its centre and radius, and the rectangle is located by one of its diagonal.

输入格式
The first line of input is a positive integer P which indicates the number of test cases. Then P test cases follow. Each test cases consists of seven real numbers, they are X,Y,R,X1,Y1,X2,Y2. That means the centre of a circle is (X,Y) and the radius of the circle is R, and one of the rectangle's diagonal is (X1,Y1)-(X2,Y2).
输出格式
For each test case, if the rectangle and the circle intersects, just output "YES" in a single line, or you should output "NO" in a single line.
输入样例 复制
2
1 1 1 1 2 4 3
1 1 1 1 3 4 4.5
输出样例 复制
YES
NO