10250 The Other Two Trees 正方形坐标几何题
来源:互联网 发布:php加减乘除计算器 编辑:程序博客网 时间:2024/06/10 07:30
题目给出两个点的坐标,要求你求出以这两个点连线为对角边的正方形的另外两个点的坐标。
画图找规律就可以了。根据相似三角形用比例求即可。
蛋疼的发现y1好像不能做变量名,我还以为什么错了。。。
代码:
#include <cstdio>#include <cmath>using namespace std;double x1, yl, x2, y2, ax, ay, bx, by;int main() {while (scanf("%lf%lf%lf%lf", &x1, &yl, &x2, &y2) != EOF) {if (abs (x1 - x2) < 1e-9 && abs (yl - y2) < 1e-9) {printf("Impossible.\n");continue;}ax = (x1 + x2 + yl - y2) / 2;ay = (yl + y2 + x2 - x1) / 2;bx = (x1 + x2 + y2 - yl) / 2;by = (yl + y2 + x1 - x2) / 2;printf("%lf %lf %lf %lf\n", ax, ay, bx, by);}return 0;}
- 10250 The Other Two Trees 正方形坐标几何题
- 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 (简单计算几何)
- 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
- WIN32界面开发之三:DUI雏形开发(二)
- struct kset_uevent_ops
- SendMessage自定义消息函数
- Mysql用户密码设置修改和权限分配
- 汇享大数据:创造医疗卫生新价值
- 10250 The Other Two Trees 正方形坐标几何题
- 带你走进EJB--EJB实例
- poj1125 floyed 求最短路
- poj1258 最小生成树 prim算法
- C#和C++中char类型的区别
- 深入理解JVM内幕
- 2013中国SEO排行榜:SEO项目管理策略
- HDU-畅通工程-1863
- LINUX下串行设备驱动程序