10250 The Other Two Trees(几何)
来源:互联网 发布:onlyanna淘宝 编辑:程序博客网 时间:2024/06/05 14:13
10250 The Other Two Trees
You have a quadrilateral shaped land whose opposite fences are of equal length. You have four neighbors whose lands are exactly adjacent to your four fences, that means you have a common fence with all of them. For example if you have a fence of lengthd in one side, this fence of length d is also the fence of the adjacent neighbor on that side. The adjacent neighbors have no fence in common among themselves and their lands also don’t intersect. The main difference between their land and your land is that their lands are all square shaped. All your neighbors have a tree at the center of their lands. Given the Cartesian coordinates of trees of two opposite neighbors, you will have to find the Cartesian coordinates of the other two trees.
Input
The input file contains several lines of input. Each line contains four floating point or integer numbersx1, y1, x2, y2, where(x1, y1), (x2, y2) are the coordinates of the trees of two opposite neighbors. Input is terminated by end of file.
Output
For each line of input produce one line of output which contains the line “Impossible.” without the quotes, if you cannot determine the coordinates of the other two trees. Otherwise, print four floating point numbers separated by a single space with ten digits after the decimal pointax1, ay1, ax2, ay2, where(ax1, ay1) and (ax2, ay2) are the coordinates of the other two trees. The output will be checked with special judge program, so don’t worry about the ordering of the points or small precision errors. The sample output will make it clear.
Sample Input
10 0 -10 0
10 0 -10 0
10 0 -10 0
Sample Output(三组其实是一样的)
0.0000000000 10.0000000000 0.0000000000 -10.0000000000
0.0000000000 10.0000000000 -0.0000000000 -10.0000000000
0.0000000000 -10.0000000000 0.0000000000 10.0000000000题目大意:已知正方形两点坐标,求另两点坐标。
解题思路:初中水准的题目,我第一次交没考虑“imposible”的情况也AC了……
#include<stdio.h>#include<math.h>int main(){double x1, y1, x2, y2;while(scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2) != EOF){if(fabs(x1 - x2) == 0 && fabs(y1 - y2) == 0){printf("Impossible.\n");continue;}double x3 = (x1 + x2) / 2, y3 = (y1 + y2) / 2;double x4 = (x1 - x2) / 2, y4 = (y1 - y2) / 2;printf("%.10lf %.10lf %.10lf %.10lf\n", x3 + y4, y3 - x4, x3 - y4, y3 + x4);}return 0;}
- 10250 The Other Two Trees(几何)
- UVA 10250 - The Other Two Trees(几何)
- uva 10250 The Other Two Trees(几何推导)
- UVA - 10250 - The Other Two Trees (简单计算几何)
- 10250 The Other Two Trees 正方形坐标几何题
- UVa 10250 The Other Two Trees (计算几何)
- 10250 - The Other Two Trees
- 10250 - The Other Two Trees
- 10250 The Other Two Trees
- 10250 - The Other Two Trees
- The Other Two Trees
- 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
- 斯坦福大学公开课 :机器学习课程(Andrew Ng)——4、监督学习:Naive Bayes
- Chapter 4
- 十分详细的测试unity与android之间的通
- eclipselink + jpa + mysql 的用法
- 2015年规划和14年总结
- 10250 The Other Two Trees(几何)
- MY MODERN MET评选:2014年度最惊艳的37张照片
- Android 共享内存
- 组合算法-C++实现
- Linux中各目录的作用以及管理服务器的注意事项
- 我的 emacs 笔记
- jQuery学习(二.3)
- css3中的结构伪类选择器
- SGD(随机梯度下降)