博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Kite(几何+镜面对称)
阅读量:5088 次
发布时间:2019-06-13

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

C. Kite

Time Limit: 1000ms   Case Time Limit: 1000ms   Memory Limit: 65536KB

 
Vova bought a kite construction kit in a market in Guangzhou. The next day the weather was good and he decided to make the kite and fly it. Manufacturing instructions, of course, were only in Chinese, so Vova decided that he can do without it. After a little tinkering, he constructed a kite in the form of a flat quadrangle and only needed to stick a tail to it.
And then Vova had to think about that: to what point of the quadrangle's border should he stick the kite tail? Intuition told him that in order to make the kite fly steadily, its tail should lie on some axis of symmetry of the quadrangle. On the left you can see two figures of stable kites, and on the right you can see two figures of unstable kites.
Problem illustration
How many points on the quadrangle border are there such that if we stick a tail to them, we get a stable kite?
 

Input

The four lines contain the coordinates of the quadrangle's vertices in a circular order. All coordinates are integers, their absolute values don't exceed 1 000. No three consecutive quadrangle vertices lie on the same line. The opposite sides of the quadrangle do not intersect.
 

Output

Print the number of points on the quadrangle border where you can attach the kite.
 

Sample Input

input output
0 01 22 22 1
2
0 02 12 20 2
0
 

Hint

The axis of symmetry of a flat figure is a straight line lying in the figure plane and dividing the figure to the two halves that are each other's mirror image.
 
 
 

 题意:求四边形,镜面对称的点;

思路:首先镜面对称,那么点的个数就是一定是偶数倍的。然后既然是镜面对称,那么他的投影点和点的镜面的距离一定是相等的;

 

转载请注明出处:  

 

 

 

so......

 

1 #include
2 #include
3 #include
4 #define PI acos(-1.0) 5 using namespace std; 6 7 struct Point 8 { 9 double x,y; 10 Point(double x=0,double y=0):x(x),y(y){}//构造函数,方便代码编写 11 }; 12 13 typedef Point Vector;//Vector只是Point的别名 14 15 //向量+向量=向量; 向量+点=点 16 Vector operator + (Vector A,Vector B){
return Vector(A.x+B.x,A.y+B.y);} 17 18 //点-点=向量 19 Vector operator - (Point A,Point B){
return Vector(A.x-B.x,A.y-B.y);} 20 21 //向量*数=向量 22 Vector operator * (Vector A,double p){
return Vector(A.x*p,A.y*p);} 23 24 //向量/数=向量 25 Vector operator / (Vector A,double p){
return Vector(A.x/p,A.y/p);} 26 27 // 28 bool operator < (const Point& a,const Point& b){
return a.x
View Code

 

 
 
 
 
 
 
 
 
 

转载于:https://www.cnblogs.com/yuyixingkong/p/4440027.html

你可能感兴趣的文章
移动端页面开发适配 rem布局原理
查看>>
Ajax中文乱码问题解决方法(服务器端用servlet)
查看>>
会计电算化常考题目一
查看>>
阿里云服务器CentOS6.9安装Mysql
查看>>
剑指offer系列6:数值的整数次方
查看>>
js 过滤敏感词
查看>>
poj2752 Seek the Name, Seek the Fame
查看>>
软件开发和软件测试,我该如何选择?(蜗牛学院)
查看>>
基本封装方法
查看>>
bcb ole拖拽功能的实现
查看>>
生活大爆炸之何为光速
查看>>
bzoj 2456: mode【瞎搞】
查看>>
[Typescript] Specify Exact Values with TypeScript’s Literal Types
查看>>
[GraphQL] Reuse Query Fields with GraphQL Fragments
查看>>
Illustrated C#学习笔记(一)
查看>>
理解oracle中连接和会话
查看>>
两种最常用的Sticky footer布局方式
查看>>
Scrapy实战篇(三)之爬取豆瓣电影短评
查看>>
HDU 5510 Bazinga KMP
查看>>
[13年迁移]Firefox下margin-top问题
查看>>