Clarke and five-pointed star
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.
InputThe first line contains an integer T(1≤T≤10)T(1≤T≤10), the number of the test cases.
For each test case, 5 lines follow. Each line contains 2 real numbers xi,yi(−109≤xi,yi≤109)xi,yi(−109≤xi,yi≤109), denoting the coordinate of this point.OutputTwo numbers are equal if and only if the difference between them is less than 10−410−4.
For each test case, print YesYes if they can compose a five-pointed star. Otherwise, print NoNo. (If 5 points are the same, print YesYes. )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
我想了下,感觉这道题做法很多啊,判边判点的,但是一想还是觉得判边比较轻松,只要考率里面五条边相等,外面五条边相等就好了
#include<bits/stdc++.h>
using namespace std;
int main() {
int T,i,j;
double x[],y[],a[];
scanf("%d",&T);
while(T--) {
for(i=; i<; i++)
scanf("%lf%lf",&x[i],&y[i]);
int t=,f=;
for(i=; i<; i++)
for(j=; j<i; j++)
a[t++]=(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]);
sort(a,a+t);
for(i=; i<; i++)
if(i!=&&fabs(a[i]-a[i+])>0.0001) f=;
printf("%s\n",f?"Yes":"No");
}
return ;
}
Clarke and five-pointed star的更多相关文章
- all unicode
Unicode Chart Range Decimal Name 0x0000-0x007F 0-127 Basic Latin 0x0080-0x00FF 128-255 Latin-1 Suppl ...
- 微信emoji的code
const MAP = [ "\xc2\xa9" => 'COPYRIGHT SIGN', "\xc2\xae" => ...
- 字体jquery ---
You don’t need icons! Here are 100+ unicode symbols that you can use Danny Markov December 3rd, 2014 ...
- QQ表情代码大全,你知道几个??
很久没有给大家分享代码了,今天趁着有点时间来给大家分享一下QQ空间的表情代码!不用感谢我,大家拿去用吧! [em]e100[/em] 微笑bai[em]e101[/em] 撇嘴[em]e102[/em ...
- hdu 5563 Clarke and five-pointed star 水题
Clarke and five-pointed star Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/show ...
- 时隔一年再读到the star
The Star Arthur C. Clarke It is three thousand light-years to the Vatican. Once, I believed that spa ...
- BC-Clarke and five-pointed star(水)
Clarke and five-pointed star Accepts: 237 Submissions: 591 Time Limit: 2000/1000 MS (Java/Others) Me ...
- HDU_5563Clarke and five-pointed star
Clarke and five-pointed star Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K ( ...
- hdoj--5563--Clarke and five-pointed star(简单几何)
Clarke and five-pointed star Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K ( ...
随机推荐
- uvm_mem——寄存器模型(十二)
看完了寄存器,再来看看存储器: //------------------------------------------------------------------------------ // ...
- Java中方法的继承以及父类未被子类覆盖的方法调用的问题
在看java继承这一块的时候发现了一个问题,即父类未被子类覆盖的方法是如何调用的? 是子类拥有了父类的该方法只是没有显示表示,还是子类调用了父类的该方法. 为此做了一下验证 代码如下: public ...
- 如何用Windows PowerShell替换命令提示符
在Windows 10的"开始"按钮中将PowerShell替换为命令提示符,这不是很好吗?我知道你会有疑问,为什么要这样做?可能会失去了运行DOS命令的能力.好吧,让我解释一下. ...
- Python2和Python3语法区别
1.使用for循环进行换行 python 2.x, print 不换行>>> print x, python 3.x print 不换行>>> print(x, e ...
- HTML视频简介
此文章复制原来文章,原网址是https://www.html5rocks.com/zh/tutorials/video/basics/#toc-encode 简介 视频标记是 HTML5 功能中备受关 ...
- UITableView设计思想 考察
整体使用了build模式:单是组织结构混乱:不符合人类思维. UITableViewDataSource:描述了View的要素个数情况:并担负了builder功能. UITableViewDelega ...
- [学习笔记] C++ 历年试题解析(三)--小补充
小小的补充一下吧,因为李老师又把直招的卷子发出来了.. 题目 1.有指针变量定义及初始化int *p=new int[10];执行delete [] p;操作将结束指针变量p的生命期.(×) 解释:试 ...
- 影响一个UIView是否能正常显示的几个因素
在使用代码实现UIView及其子类的对象的时候,经常会遇到创建的某个view没有显示在屏幕上.以下总结了本人遇到过的几种情况.可能还有些其它的原因也会导致view不能正常显示,限于个人经历有限,无法全 ...
- 2018.5.4 AndroidStudio遇到的问题
新建项目初出现异常报错 Error:Execution failed for task ':app:preDebugAndroidTestBuild'. > Conflict 发生这类型的错误, ...
- Sublime +Markdown+OmniMarkupPreviewer 搭建实时预览的markdown编辑器
浏览器实时预览 <meta http-equiv="refresh" content="0.1"> auto save 的配置 {"aut ...