博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Lightoj1211——Intersection of Cubes(立方体的交)
阅读量:2344 次
发布时间:2019-05-10

本文共 1483 字,大约阅读时间需要 4 分钟。

You are given n cubes, each cube is described by two points in 3D space: (x1, y1, z1) being one corner of the cube and (x2, y2, z2) being the opposite corner. Assume that the sides of each of the cubes are parallel to the axis. Your task is to find the volume of their intersection.

Input

Input starts with an integer T (≤ 100), denoting the number of test cases.

Each case starts with a line containing an integer n (1 ≤ n ≤ 100). Each of the next n lines contains six integers x1 y1 z1 x2 y2 z2 (1 ≤ x1, y1, z1, x2, y2, z2 ≤ 1000, x1 < x2, y1 < y2, z1 < z2) where (x1, y1, z1) is the co-ordinate of one corner and (x2, y2, z2) is the co-ordinate of the opposite corner.

Output

For each case, print the case number and volume of their intersection.

Sample Input

2

2
1 1 1 3 3 3
1 1 1 2 2 2
3
7 8 9 20 20 30
2 2 2 50 50 50
13 14 15 18 30 40
Output for Sample Input

Case 1: 1

Case 2: 450

给出底下的坐标和与其相对的坐标,求立方体的交

交集的底坐标由最大的那个决定,顶坐标反之

#include 
#include
#include
#include
#include
#include
#include
#include
#include
#define INF 0x3f3f3f3f#define MAXN 2005#define Mod 10001using namespace std;int up[MAXN],down[MAXN],tup[MAXN],tdown[MAXN];int main(){ int t,cnt=1; scanf("%d",&t); while(t--) { int n; scanf("%d",&n); for(int i=0; i<3; ++i) scanf("%d",&down[i]); for(int i=0; i<3; ++i) scanf("%d",&up[i]); for(int j=0; j
up[i]) flag=true; area*=(up[i]-down[i]); } if(!flag) printf("%d\n",area); else printf("0\n"); } return 0;}

转载地址:http://dpcvb.baihongyu.com/

你可能感兴趣的文章
spring 简述
查看>>
HttpClient-03Http状态管理
查看>>
spring cloud 启动报错-must be declared as an @AliasFor [serviceId], not [name].
查看>>
常用软件下载地址
查看>>
修改spring boot 启动logo
查看>>
spring boot-启动及配置文件
查看>>
HttpsURLConnection 安全传输(HTTPS--Secure Hypertext Transfer Protocol-安全超文本传输协议)...
查看>>
ASP.NET跨页面传值的技巧
查看>>
ASP.NET页面之间传递值解析
查看>>
我要学ASP.NET MVC 3.0(八): MVC 3.0 传递和保存你的Model
查看>>
我要学ASP.NET MVC 3.0(九): MVC 3.0 验证你的Model
查看>>
我要学ASP.NET MVC 3.0(十): MVC 3.0 使用 Forms身份验证
查看>>
我要学ASP.NET MVC 3.0(十一): MVC 3.0 使用筛选器
查看>>
ASP.NET MVC3、Pager 分页
查看>>
在 ASP.NET MVC 中创建自定义 HtmlHelper 控件
查看>>
MSDN---扩展方法 (C# 方法中的this参数)
查看>>
我要学ASP.NET MVC 3.0(十四): MVC 3.0 实例系列之创建数据表格
查看>>
我要学ASP.NET MVC 3.0(十五): MVC 3.0 实例系列之表格的排序
查看>>
我要学ASP.NET MVC 3.0(十七): MVC 3.0 实例之表格中数据的筛选
查看>>
Displaying a Sorted, Paged, and Filtered Grid of Data in ASP.NET MVC
查看>>