hdu5563 ( Clarke and five-pointed star )
来源:互联网 发布:俄罗斯生活知乎 编辑:程序博客网 时间:2024/05/16 13:42
#include<iostream>#include<algorithm>#include<cstdio>#include<cmath>using namespace std;//pointconst double eps = 1e-8;const double PI = acos(-1.0);int sgn(double x) { if(fabs(x)<eps) return 0; if(x < 0) return -1; else return 1;}struct Point{ double x, y; Point() {} Point(double _x, double _y){ x = _x; y = _y; } Point operator -(const Point& b)const { return Point(x - b.x, y-b.y); } double operator ^(const Point& b)const { return x*b.y-y*b.x; } double operator *(const Point& b)const { return x*b.x+y*b.y; } int operator ==(const Point& b)const{ //精度处理 判断两点是否相等 return !(sgn(x-b.x)&&sgn(y-b.y)); } void transXY(double B){ double tx = x, ty = y; x = tx*cos(B)-ty*sin(B); y = tx*sin(B)+ty*cos(B); }};double dist(Point a, Point b){ return sqrt((a-b)*(a-b));}bool jg(Point* P,int n){ int a[5] = {0, 1, 2, 3, 4}; do{ int ok = 1; double bz1 = dist(P[a[0]], P[a[2]]); for(int i = 1; i < 5; i++){ if(fabs(bz1-dist(P[a[i]], P[a[(i+2)%5]]))>=1e-4)//比较他们的对角线长度 { ok = 0; break; } } double bz2 = dist(P[a[0]], P[a[1]]); for(int i = 1; i < 5; i++){ if(fabs(bz2-dist(P[a[i]], P[a[(i+1)%5]]))>=1e-4)//比较相邻边的长度 { ok = 0; break; } } if(ok) return 1; }while(next_permutation(a, a+n)); return 0;}int main() { Point a[5]; int n; scanf("%d", &n); while(n--){ for(int i = 0; i < 5; i++) { cin >> a[i].x >> a[i].y ; } if(jg(a, 5))cout << "Yes" << endl; else cout << "No"<< endl; } }
0 0
- hdu5563 ( Clarke and five-pointed star )
- hdu5563 Clarke and five-pointed star
- hdu5563 Clarke and five-pointed star(判正五边形,精度问题)
- HDU 5563 Clarke and five-pointed star
- HDU-5563 (Clarke and five-pointed star)
- HDOJ 5563 Clarke and five-pointed star
- 【HDU5563 BestCoder Round 62 (div1)A】【计算几何 凸包】Clarke and five-pointed star 正五边形判定 正五角星判定
- BC-Clarke and five-pointed star(水)
- HDOJ 5563 Clarke and five-pointed star(枚举)
- BestCoder Round #62 (div.2) Clarke and five-pointed star
- hdu 5563 Clarke and five-pointed star(几何)
- HDU 5563 Clarke and five-pointed star(判断正五边形)
- HDU 5563 Clarke and five-pointed star(暴力)
- hdoj 5563 Clarke and five-pointed star 【判断五角星】
- hdoj--5563--Clarke and five-pointed star(简单几何)
- HDU 5562 Clarke and five-pointed star (BC)
- HDU_5563Clarke and five-pointed star
- BestCoder Round #62 (div.2)-Clarke and five-pointed star(几何)
- 使用VMware VSphere WebService SDK进行开发 (七)——获取数据中心、集群、主机、虚拟机的目录结构
- 【leetcode】Kth Smallest Element in a BST
- UVa 914 - Jumping Champion
- A3 NO SELECT The login is O EXAMINE The login is not saf your mail client: http://mail.163.com/dashi
- Zookeeper已经分布式环境中的假死脑裂
- hdu5563 ( Clarke and five-pointed star )
- 排序算法JAVA实现三
- 对js中的引用类型的理解(2)——Object类型
- SimpleDateFormat在jdk1.6与jdk1.7之间的差别
- linux设备树中pinctrl的配置(下)
- 【FOJ2206 11月月赛B】【观察找规律】函数求解 分析函数求值
- 文档的吐槽
- C++ 在函数中用static定义的变量的
- FastDFS的配置、部署与API使用解读(7)Nginx的FastDFS模块