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 ( ...
随机推荐
- git如何强制用远程分支更新本地
git本地即使有修改如何强制更新: 本地有修改和提交,如何强制用远程的库更新本地.我尝试过用git pull -f,总是提示 You have not concluded your merge. (M ...
- 一键部署基于SVN开源版本控制系统
https://market.azure.cn/Vhd/Show?vhdId=11889&version=12961 产品详情 产品介绍Subversion作为新一代的开源版本控制工具,Sub ...
- 地址栏传值 JS取值方法
function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&] ...
- jspscriptlet标签
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding= ...
- 【Python图像特征的音乐序列生成】生成伴奏旋律(附部分代码)
做了半天做的都是一些细枝末节的东西,嗨呀. 伴奏旋律是Ukulele和弦,MIDI发音乐器是Guitar.在弹唱的时候,Ukulele和弦就是伴奏. 我们以创建<成都>伴奏为例: 节奏型: ...
- UVA 11093 Just Finish it up 环形跑道 (贪心)
有一个环形跑道,上面有n个加油站,到i号加油站可以加pi的油,跑到下一站要花费qi的油,起点任意选,问是否有一个起点可跑完整个跑道. 从i开始跑,如果遇到某个站j不能跑了,那么从i到j之间的站开始跑, ...
- vue2使用animate css
先上几个链接 vue插件大集合:awesome-vue vue2插件: vue2-animate:vue2-animate vue2插件vue2-animateDEMO: vue2-animatede ...
- phpmyadmin设置不密码,不登录直接进入
1.config.sample.inc.php改为config.inc.php 2.加入或更改代码: [php] $cfg['Servers'][$i]['auth_type'] = 'config' ...
- python 基础之格式化输出
字符占位符%s #_cvvh:"chenxi" #date: 2019/6/24 print ('chhjg') # 格式化输出 name = input("Name:& ...
- 2018.5.8 XML编程
1.XML的概念 XML(Extensible Markup Language)可扩展性标记语言是一套定义语义标记的规则,这些标记将文档分成许多部件并对这些部件加以标识. 可拓展性标记语言是SGML( ...