题目描述
<p><span style="font-size: large;"><span style="font-family: Arial;"> There are two rectangles on the same plane and their sides are parallel to x-axis and y-axis. You are given the coordinates of two points on the diagonals of each rectangle. Now you need to count the total area of these two rectangles. Please don't count the area of the intersected part of two rectangles twice.<br /> </span></span></p>
输入格式
<p><span style="font-size: large;"><span style="font-family: Arial;"> The first line of the input file contains one integer T which is the number of test cases following. Each test case contains 8 integers which are the coordinates of four points which are metioned before. These 8 numbers are x1,y1,x3,y3,x2,y2,x4,y4. (x1,y1) and (x2,y2) are the points on the first retangle. (x3,y3) and (x4,y4) are the points on the second retangle. <br /> What's more, -1000000<= xi, yi(1<=i<=4) <= 1000000.<br /> </span></span></p>
输出格式
<p><span style="font-size: large;"><span style="font-family: Arial;"> Output the total area of two rectangles for each case in a single line.<br /> </span></span></p>
样例
样例输入 1
1
0 0 2 2 2 2 1 1
样例输出 1
4
提交代码
请先登录后提交
🤖 AI 解题助手
DeepSeek
就绪