博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Clarke and five-pointed star
阅读量:6950 次
发布时间:2019-06-27

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

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.

InputThe first line contains an integer T(1T10)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(109xi,yi109)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 10410−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

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

我想了下,感觉这道题做法很多啊,判边判点的,但是一想还是觉得判边比较轻松,只要考率里面五条边相等,外面五条边相等就好了

#include
using namespace std;int main() { int T,i,j; double x[5],y[5],a[15]; scanf("%d",&T); while(T--) { for(i=0; i<5; i++) scanf("%lf%lf",&x[i],&y[i]); int t=0,f=1; for(i=0; i<5; i++) for(j=0; j
0.0001) f=0; printf("%s\n",f?"Yes":"No"); } return 0;}

 

转载于:https://www.cnblogs.com/BobHuang/p/7258735.html

你可能感兴趣的文章
go源码分析:strings包
查看>>
Min_25筛学习笔记
查看>>
错误分析:程序集未标记为可序列化
查看>>
禅与文件和文件夹组织的艺术 —— 上
查看>>
Linux自带-系统级性能分析工具 — Perf(转)
查看>>
[HNOI2010]物品调度
查看>>
Keras网络层之常用层Core
查看>>
C# 选择文件、选择文件夹、打开文件(或者文件夹) 路径中获取文件全路径、目录、扩展名、文件名称 追加、拷贝、删除、移动文件、创建目录 修改文件名、文件夹名!!...
查看>>
python学习笔记之——文件I/O
查看>>
【双旦献礼】Portal-Basic Java Web 应用开发框架 v3.0.1 正式发布(源码、示例及文档)...
查看>>
quartz.net的使用
查看>>
split-array-largest-sum(参考了discuss)
查看>>
Mybatis,模糊查询语句,以及传参数的正确写法
查看>>
路由器后面再接一个路由器怎么设置(二级路由)
查看>>
jetty服务器启动方法总结【备用】
查看>>
yii cmenu 中使用 onclick
查看>>
python 字典value排序
查看>>
nginx 添加https 配置
查看>>
中文自然语言处理:手写两个方法去掉字符串中的空格
查看>>
fetch方法
查看>>