# Clarke and five-pointed star

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 420    Accepted Submission(s): 227

Problem Description
Clarke is a patient with multiple personality disorder. One day, Clarke turned into a learner of geometric.
When he did a research with polygons, he found he has to judge if the polygon is a five-pointed star at many times. There are 5 points on a plane, he wants to know if a five-pointed star existed with 5 points given.

Input
The first line contains an integer T(1T10), the number of the test cases.
For each test case, 5 lines follow. Each line contains 2 real numbers xi,yi(109xi,yi109), denoting the coordinate of this point.

Output
Two numbers are equal if and only if the difference between them is less than104.
For each test case, print Yes if they can compose a five-pointed star. Otherwise, print No. (If 5 points are the same, print Yes. )

Sample Input
2 3.0000000 0.0000000 0.9270509 2.8531695 0.9270509 -2.8531695 -2.4270509 1.7633557 -2.4270509 -1.7633557 3.0000000 1.0000000 0.9270509 2.8531695 0.9270509 -2.8531695 -2.4270509 1.7633557 -2.4270509 -1.7633557

Sample Output
Yes No
Hint

<pre name="code" class="cpp">#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stack>
#include<iostream>
#include<algorithm>
#define fab(a) (a)>0?(a):(-a)
#define LL long long
#define MAXN 1000010
#define mem(x) memset(x,0,sizeof(x))
#define INF 0xfffffff
using namespace std;
struct s
{
double x,y;
}a[10];
int v[10][10];
double dis[1000];
double fun(s aa,s bb)
{
return sqrt((aa.x-bb.x)*(aa.x-bb.x)+(aa.y-bb.y)*(aa.y-bb.y));
}
int main()
{
int t,i,j;
scanf("%d",&t);
while(t--)
{
for(i=0;i<5;i++)
scanf("%lf%lf",&a[i].x,&a[i].y);
mem(v);
int k=0;
double mi=1.0*INF;
for(i=0;i<5;i++)
{
for(j=i+1;j<5;j++)
{
if(v[i][j]||v[j][i])
continue;
dis[k]=fun(a[i],a[j]);
mi=min(mi,dis[k]);
v[i][j]=1;
k++;
}
}
int cnt=0;
for(i=0;i<k;i++)
{
if(dis[i]-mi<=1e-4)//精度问题
cnt++;
}
if(cnt==5)
printf("Yes\n");
else
printf("No\n");
}
return 0;
}

#### hdoj 5563 Clarke and five-pointed star 【判断五角星】

2015-12-05 21:38:13

#### hdoj Clarke and five-pointed star 5563 （判断能否组成五角星）

2015-11-25 22:19:56

#### HDOJ 5563 Clarke and five-pointed star

2016-10-13 16:08:49

#### 五角星五个顶点的位置？

2009-10-19 14:47:00

#### HDOJ 5563 Clarke and five-pointed star(枚举)

2015-11-14 22:44:32

#### HDU 5563 Clarke and five-pointed star

2015-11-29 22:59:44

#### HDU 5563 Clarke and five-pointed star（判断正五边形）

2015-11-17 23:57:48

#### 获取五角星的顶点坐标

2015-11-27 14:49:54

#### 五角星五个角在坐标系上面的坐标计算[图]

2011-10-06 16:30:28

#### HDU 5563 Clarke and five-pointed star(暴力)

2015-11-18 11:04:29