HDU 5206 Four Inages Strategy 水题
题目链接:
hdu:http://acm.hdu.edu.cn/showproblem.php?pid=5206
bc(中文):http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=577&pid=1001
题解:
先判四点是否共面,然后再判断一下四条邻边相等并且两条对角线相等就可以了。
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std; const int maxn=+;
typedef long long LL; struct Point {
LL x,y,z;
Point(LL x,LL y,LL z):x(x),y(y),z(z){}
Point(){};
friend Point operator - (const Point& p1,const Point& p2){
return Point(p1.x-p2.x,p1.y-p2.y,p1.z-p2.z);
}
} pt[]; typedef Point Vector; Vector cross(const Vector& v1,const Vector& v2){
return Vector(v1.y*v2.z-v1.z*v2.y,v2.x*v1.z-v1.x*v2.z,v1.x*v2.y-v1.y*v2.x);
} LL dis(int i,int j) {
Point pt1=pt[i];
Point pt2=pt[j];
return (pt1.x-pt2.x)*(pt1.x-pt2.x)+(pt1.y-pt2.y)*(pt1.y-pt2.y)+(pt1.z-pt2.z)*(pt1.z-pt2.z);
} bool judge(){
Vector v1=pt[]-pt[];
Vector v2=pt[]-pt[];
Vector v3=pt[]-pt[];
Vector cr1=cross(v1,v2);
Vector cr2=cross(v2,v3);
Vector ret=cross(cr1,cr2);
if(!ret.x&&!ret.y&&!ret.z) return true;
return false;
} int main() {
int tc,kase=;
scanf("%d",&tc);
while(tc--) {
for(int i=; i<; i++) scanf("%lld%lld%lld",&pt[i].x,&pt[i].y,&pt[i].z);
int flag=;
if(judge()) {
for(int i=; i<; i++) {
for(int j=; j<; j++) {
if(j!=i) {
for(int k=; k<; k++) {
if(k!=j&&k!=i) {
for(int l=; l<; l++) {
if(l!=i&&l!=j&&l!=k) {
if(dis(i,j)==dis(j,k)&&dis(j,k)==dis(k,l)&&dis(k,l)==dis(l,i)&&dis(i,k)==dis(j,l)) {
flag=;
}
}
}
}
}
}
}
}
}
printf("Case #%d: ",++kase);
if(flag) {
puts("Yes");
} else {
puts("No");
}
}
return ;
}
/*
1 0 0 0 1 0 0 -1 0 0 0 1
1 0 0 0 1 0 0 -1 0 -1 0 0
*/
HDU 5206 Four Inages Strategy 水题的更多相关文章
- hdu 5206 Four Inages Strategy 判断是否是正方形
Four Inages Strategy Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem. ...
- hdu 5206 Four Inages Strategy 计算几何
题目链接:HDU - 5206 Young F found a secret record which inherited from ancient times in ancestral home b ...
- hdu 5206 Four Inages Strategy
题目大意: 判断空间上4个点是否形成一个正方形 分析: 标称思想 : 在p2,p3,p4中枚举两个点作为p1的邻点,不妨设为pi,pj,然后判断p1pi与p1pj是否相等.互相垂直,然后由向量法,最后 ...
- HDU 5538 L - House Building 水题
L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
- HDU 5578 Friendship of Frog 水题
Friendship of Frog Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
- HDU 5590 ZYB's Biology 水题
ZYB's Biology Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid ...
- hdu 1005:Number Sequence(水题)
Number Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- hdu 1018:Big Number(水题)
Big Number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total ...
- hdu 2041:超级楼梯(水题,递归)
超级楼梯 Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Submission(s): Accepted Su ...
随机推荐
- 使用nohup或者tmux将程序挂在后台
程序挂在后台 nohup nohup 命令 & 这样的命令会将屏幕的输出重定向到同目录的nohup.out中,可以使用 > 来重定向输出. nohup 命令 > .log & ...
- NCBI SRA数据库使用详解
转:https://shengxin.ren/article/16 https://www.cnblogs.com/lmt921108/p/7442699.html 批量下载SRA http://ww ...
- SDR软件无线电知识要点(一)噪声系数与噪声因子
SDR软件无线电知识要点(一)噪声系数与噪声因子 信号质量如何评估 Noise Figure (NF) or sensitivity and Error Vector Magnitude (EVM) ...
- #《JAVA程序设计》 20155214 实验五 网络编程与安全
<JAVA程序设计> 20155214 实验五 网络编程与安全 实验内容 掌握Socket程序的编写: 掌握密码技术的使用: 设计安全传输系统. 实验要求 要求一 结对实现中缀表达式转后缀 ...
- 20155308 2016-2017-2 《Java程序设计》实验3
20155308 2016-2017-2 <Java程序设计>实验3 实验内容 XP基础 XP核心实践 相关工具 实验步骤 (一)敏捷开发与XP 敏捷开发是一种以人为核心.迭代.循序渐进的 ...
- 20155338 2016-2017-2 《Java程序设计》第10周学习总结
20155338 2016-2017-2 <Java程序设计>第10周学习总结 教材学习内容总结 网络编程 · 网络编程就是在两个或两个以上的设备(例如计算机)之间传输数据.程序员所作的事 ...
- 20145207《Java程序设计》实验二(Java面向对象程序设计)实验报告
<Java程序设计>实验二(Java面向对象程序设计)实验报告 目录 改变 Java面向对象程序设计实验要求 实验成果 课后思考 改变 看了下之前实验二的整体,很搞笑,大图+代码,没了.. ...
- 20145209 实验四 《android开发基础》 实验报告
20145209 实验四 <android开发基础> 实验报告 实验内容 Android Stuidio的安装测试: 参考<Java和Android开发学习指南(第二版)(EPUBI ...
- python 多线程笔记(6)-- 生产者/消费者模式(续)
用 threading.Event() 也可以实现生产者/消费者模式 (自己拍脑袋想出来的,无法知道其正确性,请大神告知为谢!) import threading import time import ...
- 【LG3231】[HNOI2013]消毒
题面 洛谷 题解 代码 \(100pts\) #include<iostream> #include<cstdio> #include<cstdlib> #incl ...