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

原创 2015年11月18日 11:04:29

Clarke and five-pointed star

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


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 than 104.
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

Source


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
double length[5][5];
double point[5][2];
const double MIN=1e-4;
int main(){
	int t,i,j;
	scanf("%d",&t);
	while(t--){
		bool ok=1;
		for(i=0;i<5;i++)
			scanf("%lf%lf",&point[i][0],&point[i][1]);
		for(i=0;i<5;i++){
			for(j=0;j<5;j++){
				if(i==j){
					length[i][j]=0.0;
					continue;
				}				  
				length[i][j]=(point[i][0]-point[j][0])*
				(point[i][0]-point[j][0])+(point[i][1]-point[j][1])*
				(point[i][1]-point[j][1]);				
			}
			sort(length[i],length[i]+5);
		}
	/*	for(i=0;i<5;i++){
		   printf("%0.6lf\n",length[i][1]);
		}*/
		for(i=1;i<5;i++){
			//printf("%0.6lf\n",fabs(length[0][1]-length[i][1]));
			if(fabs(length[0][1]-length[i][1])>MIN)
			  ok=0;
		}
		if(ok)
		  printf("Yes\n");
		else
		 printf("No\n");
	}
	return 0;
}


相关文章推荐

HDU_5563Clarke and five-pointed star

Clarke and five-pointed star Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K ...

【HDU5563 BestCoder Round 62 (div1)A】【计算几何 凸包】Clarke and five-pointed star 正五边形判定 正五角星判定

#include #include #include #include #include #include #include #include #include #include #include ...

BestCoder Round #62 (div.2) HDU 5563 Clarke and five-pointed star

Clarke and five-pointed star                                           Time Limit: 2000/1000 MS (Ja...

HDU 5563 Clarke and five-pointed star(判断正五边形)——BestCoder Round #62(div.1 div.2)

HDU 5563 Clarke and five-pointed star(判断正五边形)——BestCoder Round #62(div.1 div.2)

hdu5563 ( Clarke and five-pointed star )

#include #include #include #include using namespace std; //point const double eps = 1e-8; const doub...
  • czkct
  • czkct
  • 2015年11月18日 17:34
  • 230

hdoj5563Clarke and five-pointed star【判断五角星】

Clarke and five-pointed star Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (...

BestCoder Round #62 (div.2)-Clarke and five-pointed star(几何)

Clarke and five-pointed star    Accepts: 237    Submissions: 591  Time Limit: 2000/1000 MS (Java/Ot...

BestCoder Round #72 (div.2)-Clarke and chemistry(暴力枚举)

Clarke and chemistry    Accepts: 206    Submissions: 601  Time Limit: 2000/1000 MS (Java/Othe...

hdu2699 Five in a Row 暴力穷举

Five in a Row Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

HDU 3131 One…Two…Five! (暴力搜索)

题目链接:HDU 3131 One…Two…Five! (暴力搜索) 题意:给出一串数字,要求用加,减,乘,除(5/2=2)连接(计算无优先级:5+3*6=8*6=48),求所有结果中,含有‘3’且...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:HDU 5563 Clarke and five-pointed star(暴力)
举报原因:
原因补充:

(最多只允许输入30个字)