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 ( ...
 
随机推荐
- dos 删除文件夹 rd
			
windows普通方法删除不了文件.文件夹?那么试试dos命令吧. rd的另外一个写法是rmdir,源自ReMakeDirectory.使用的方法也很简单:rd 文件夹名 即可,例如:rd test. ...
 - Windows基础环境_安装配置教程(Windows7 64、JDK1.8、Android SDK23.0、TortoiseSVN 1.9.5)
			
Windows基础环境_安装配置教程(Windows7 64.JDK1.8.Android SDK23.0.TortoiseSVN 1.9.5) 安装包版本 1) JDK版本包 地址: htt ...
 - optparse 模块
			
一.optparse是专门用来在命令行添加选项的一个模块.支持python2.3及以上版本,从2.7版本之后,python不再更新该模块,2.7之后的版本推荐使用argparse模块. 二.optpa ...
 - ajax请求执行完成后再执行其他操作(jQuery.page.js插件使用为例)
			
就我们做知,ajax强大之处在于它的异步请求,但是有时候我们需要ajax执行彻底完成之后再执行其他函数或操作 这个时候往往我们用到ajax的回调函数,但是假如你不想或者不能把接下来的操作写在回调函数中 ...
 - jsp之初识UserBean
			
package com.java.model; public class Student { private String name; private int age; public String g ...
 - UVA11478 Halum (差分约束)
			
每次操作是独立的,而且顺序并不影响,作用在同一个结点上的d可以叠加,所以令x(u) = sigma(dui). 最后就是要确定所有的x(u). 因为m越大,满足条件的边就越少,二分答案m. 对于一条边 ...
 - 撤销git pull命令
			
比如:在master分支上执行了git pull命令,想回到pull之前分支所在的commit位置. 步骤一:用 git reflog master 查看master分支的历史变动记录,其中有一个就是 ...
 - 在.net平台上运行伪JAVA
			
由于在一个项目局方要求使用JAVA平台, 而当前又都是.net平台的应用. 重新用JAVA开发工作量太大. 时间也来不及. 想到在.net中有url rewrite功能, 何不先"骗&quo ...
 - linux 下使用 curl 访问带多参数,GET掉参数解决方案
			
url 为 http://mywebsite.com/index.php?a=1&b=2&c=3 web形式下访问url地址,使用 $_GET是可以获取到所有的参数 curl -s ...
 - 解决vs 编译的bug“请检查是否是磁盘空间不足、路径无效或权限不够”
			
昨晚用vs编译遇到一个问题,编译一半发现硬盘没空间,一直重启vs,重启电脑, 删除pdb文件都没用,之后尝试重新生成解决方案,就解决了.这个是vs的一个bug