博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU 5563 Clarke and five-pointed star(暴力)
阅读量:4139 次
发布时间:2019-05-25

本文共 2035 字,大约阅读时间需要 6 分钟。

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
23.0000000 0.00000000.9270509 2.85316950.9270509 -2.8531695-2.4270509 1.7633557-2.4270509 -1.76335573.0000000 1.00000000.9270509 2.85316950.9270509 -2.8531695-2.4270509 1.7633557-2.4270509 -1.7633557
Sample Output
YesNo   
Hint
Source
#include 
#include
#include
#include
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;}

转载地址:http://sfmvi.baihongyu.com/

你可能感兴趣的文章
【Python】学习笔记——-6.2、使用第三方模块
查看>>
【Python】学习笔记——-7.0、面向对象编程
查看>>
【Python】学习笔记——-7.2、访问限制
查看>>
【Python】学习笔记——-7.3、继承和多态
查看>>
【Python】学习笔记——-7.5、实例属性和类属性
查看>>
git中文安装教程
查看>>
虚拟机 CentOS7/RedHat7/OracleLinux7 配置静态IP地址 Ping 物理机和互联网
查看>>
Jackson Tree Model Example
查看>>
常用js收集
查看>>
如何防止sql注入
查看>>
springmvc传值
查看>>
在Eclipse中查看Android源码
查看>>
Android使用webservice客户端实例
查看>>
[转]C语言printf
查看>>
C 语言 学习---获取文本框内容及字符串拼接
查看>>
C 语言学习 --设置文本框内容及进制转换
查看>>
C 语言 学习---判断文本框取得的数是否是整数
查看>>
C 语言 学习---ComboBox相关、简单计算器
查看>>
C 语言 学习---ComboBox相关、简易“假”管理系统
查看>>
C 语言 学习---回调、时间定时更新程序
查看>>