UVa 10250 - The Other Two Trees
2014-02-28 08:49
453 查看
题目链接:UVa 10250 - The Other Two Trees
没做出来,看了别人的题解。
首先将四棵树连起来,你得看出来这个四边形是个正方形,然后题目就简化成了给出一个正方形和它的两个顶点左边,让求另外两个顶点坐标。
看看下边这个图就懂了。
![](http://img.blog.csdn.net/20140228084822078?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZm9iZGRkZg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
没做出来,看了别人的题解。
首先将四棵树连起来,你得看出来这个四边形是个正方形,然后题目就简化成了给出一个正方形和它的两个顶点左边,让求另外两个顶点坐标。
看看下边这个图就懂了。
#include <stdio.h> #include <math.h> #include <iostream> #include <iomanip> using namespace std; const double e = 1e-9; int main() { double x1,y1,x2,y2; double ax1, ay1, ax2, ay2; while (cin>>x1>>y1>>x2>>y2) { if (fabs(x1-x2) < e && fabs(y1-y2)< e ) { cout<<"Impossible."<<endl; continue; } ax1 = (x2 + x1 + y2 - y1) / 2; ay1 = (y2 + y1 + x1 - x2) / 2; ax2 = (x2 + x1 + y1 - y2) / 2; ay2 = (y2 + y1 + x2 - x1) / 2; cout<<fixed<<setprecision(10)<<ax1<<" "<<ay1<<" "<<ax2<<" "<<ay2<<endl; } return 0; }
相关文章推荐
- uva 10250 - The Other Two Trees
- UVA - 10250 The Other Two Trees
- UVa 10250 - The Other Two Trees
- 【Geometry】UVa10250 – The Other Two Trees
- UVa10250 – The Other Two Trees
- uva 10250 - The Other Two Trees
- UVA - 10250 The Other Two Trees
- UVA10250 The Other Two Trees
- UVA 10250 题目 The Other Two Trees (计算几何)
- uva 10250 The Other Two Trees(几何推导)
- uva_10250 - The Other Two Trees
- UVa 10250 - The Other Two Trees
- UVA 10250 The Other Two Trees
- UVA-10250 The Other Two Trees
- UVa 10250 The Other Two Trees
- UVA 10250 The Other Two Trees
- UVa 10250 The Other Two Trees
- UVa 10250 The Other Two Trees (计算几何)
- UVa 10250 The Other Two Trees(数学问题)
- UVa 10250 - The Other Two Trees