题目描述
When
displaying a collection of rectangular windows, a critical step is determining
whether two windows overlap, and, if so, where on the screen the overlapping
region lies. Write a program to perform this function. Your program will accept
as input the coordinates of two rectangular windows. If the windows do not
overlap, your program should produce a message to the effect. If they do
overlap, you should compute the coordinates of the overlapping region (which
must itself be a rectangle).
All coordinates are expressed in "pixel numbers", integer values ranging
from 0 to 9999. A rectangle will be described by two pairs of (X, Y)
coordinates. The first pair gives the coordinates of the lower left hand corner
(XLL, YLL). The second pair gives the coordinates of the upper right hand
coordinates (XUR, YUR). You are guaranteed that XLL<XUR and YLL<YUR.
Input
The first line will have a
number N (0<N<=100) with the number of test cases. Each test case will consists
of two lines each containing four numbers. The first line contains the integer
numbers XLL, YLL, XUR and YUR for the first window. The second contains the same
numbers for the second window.
Output
For each test case, if the two window do no overlap, print the
Message "No Overlap". If the two windows do overlap, print 4 integer numbers
giving the XLL, YLL, XUR and YUR for the region of overlap. Note that two windows that share a
common edge but have no other point in common are considered to have "No
Overlap".
Sample Input
2
0 20
100 120
80 0
500 60
10 10
20 20
30 30
40 40
Sample Output
80 20
100 60
No
Overlap
输入格式
见题面
输出格式
见题面