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 5563 Clarke and five-pointed star

Problem Description Clarke is a patient with multiple personality disorder. One day, Clarke turne...
  • jtjy568805874
  • jtjy568805874
  • 2015年11月29日 22:59
  • 204

CodeForces 549D (暴力、模拟)

D. Haar Features time limit per test 1 second memory limit per test 256 megabytes input standard ...
  • aaaaacmer
  • aaaaacmer
  • 2015年07月18日 18:33
  • 541

HDOJ 5563 Clarke and five-pointed star

Clarke and five-pointed star Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K ...
  • qq_34542903
  • qq_34542903
  • 2016年10月13日 16:08
  • 117

HDU 5563 Clarke and five-pointed star(判断正五边形)

问题描述 克拉克是一名人格分裂患者。某一天克拉克分裂为一个几何学习者,在研究多边形。 在研究某一个多边形的时候,克拉克发现他多次遇到判断5个点是否能组成一个五角星的问题,在这里,这5个点分别代表五角...
  • h1021456873
  • h1021456873
  • 2015年11月17日 23:57
  • 218

hdu 5563 Clarke and five-pointed star(几何)

题目链接:hdu 5563 Clarke and five-pointed star代码#include #include #include #include using namespace s...
  • u011328934
  • u011328934
  • 2015年11月16日 18:10
  • 396

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

Clarke and five-pointed star Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (...
  • zwj1452267376
  • zwj1452267376
  • 2015年11月14日 22:44
  • 271

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

Clarke and five-pointed star            Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 6553...
  • chenzhenyu123456
  • chenzhenyu123456
  • 2015年12月05日 21:38
  • 250

hdu 5563 five-pointed star(几何)

点击打开链接 题意:给出5个点问是否能组成5角星 5角星的5个顶点和正5边形的5个定点一一对应,即判断这5个点是否能组成正5边形(C(5,2)=10条边中是否 5个边相同 5条对角线相同即可) ...
  • Jeremy1149
  • Jeremy1149
  • 2016年12月10日 11:29
  • 134

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

Clarke and five-pointed star                                           Time Limit: 2000/1000 MS (Ja...
  • qq1319479809
  • qq1319479809
  • 2015年11月14日 23:37
  • 233

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
  • 261
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:HDU 5563 Clarke and five-pointed star(暴力)
举报原因:
原因补充:

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