POJ 2624 4th Point
来源:互联网 发布:手机上编程 编辑:程序博客网 时间:2024/06/05 05:08
这题有一个陷阱,那就是点会随意给出,并不是第二个点与第三个点相同,所以要做处理。
还有一个点就是double用%f输出。
//// main.cpp// Richard//// Created by 邵金杰 on 16/8/6.// Copyright © 2016年 邵金杰. All rights reserved.//#include<cstdio>#include<vector>using namespace std;typedef pair<double,double> CVector;typedef pair<double,double> CPoint;typedef pair<CPoint,CPoint> CLine;CVector operator + (CVector p,CVector q){ return CVector(p.first+q.first,p.second+q.second);}CVector operator - (CPoint p,CPoint q){ return CVector(p.first-q.first,p.second-q.second);}bool operator == (CPoint p,CPoint q){ return p.first==q.first&&p.second==q.second;}int main(){ double x1,y1,x2,y2,x3,y3,x4,y4; while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4)!=EOF) { CLine p=CLine(CPoint(x1,y1),CPoint(x2,y2)); CLine q=CLine(CPoint(x3,y3),CPoint(x4,y4)); if(p.first==q.first) {CPoint t=p.first;p.first=p.second;p.second=t;} else if(p.first==q.second) { CPoint t1=p.first;p.first=p.second;p.second=t1; CPoint t2=q.first;q.first=q.second;q.second=t2; } else if(p.second==q.second){CPoint t=q.first;q.first=q.second;q.second=t;} CVector v1=p.first-p.second; CVector v2=q.second-q.first; CPoint m=q.first+(v1+v2); printf("%.3f %.3f\n",m.first,m.second); } return 0;}
0 0
- poj 2624 4th Point
- POJ 2624 4th Point
- poj 2624 4th Point
- POJ 2624 4th Point(水~)
- POJ 2624 4th Point 笔记
- POJ-2624 4th Point(计算几何)
- POJ 2624 4th Point 计算几何(向量)
- POJ 2624 4th Point (计算几何)
- 百练 2624 4th Point .
- 4th Point
- POJ2624--4th Point
- POJ2424 4th Point
- HOJ 2089 4th point
- K-th Number (POJ
- ZOJ-3955-Saddle Point【17th浙大校赛】
- poj 2104 K-th Number
- poj 2104 K-th Number
- Poj 2104 K-th Number
- leetcode Word Break
- 灰度级和像素值
- Android 使用Scroller实现绚丽的ListView左右滑动删除Item效果
- C51数据类型扩充定义
- Android手机获取GPS卫星数量问题
- POJ 2624 4th Point
- Unity学习笔记 1st —— 物体会移动就是游戏的开始!
- 51单片机 数码管的显示与译码器
- Codeforces Round #365 (Div. 2) A. Mishka and Game
- android项目解刨之时间轴
- C#入门6.10——字符串的删除
- NSURLSession和NSURLConnection 的区别
- 动态上下线datanode节点及副本均衡机制
- 数据结构与算法的Java描述--1