UVA10250-The Other Two Trees
来源:互联网 发布:数据采集卡的使用 编辑:程序博客网 时间:2024/06/05 10:18
题意:有两个树,求两棵树连线上是否存在垂线,求垂线两个端点的左边。
思路:其实题目的意思,就好比是四个点构成一个正方形,类似的,就是要求其他两个端点的坐标,我用的是向量旋转,求另外两点。
公式就是(xcost - ysint,xsint + ysint),这里正好t为直角,所以就是旋转之后的向量是(-y, x)
#include<stdio.h>int main(){double x1, y1, x2, y2;double ax1, ay1, ax2, ay2;while (scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2) != EOF){if (x1 == x2 && y1 == y2){printf("Impossible.\n");continue;}double n, m;n = (x1 + x2) / 2.0; m = (y1 + y2) / 2.0;ax1 = n - (y1 - m);ay1 = m - (n - x1);ax2 = 2 * n - ax1;ay2 = 2 * m - ay1;printf("%.10lf %.10lf %.10lf %.10lf\n", ax1, ay1, ax2, ay2);}return 0;}
- UVA10250-The Other Two Trees
- UVA10250 The Other Two Trees
- uva10250 The Other Two Trees
- UVA10250 The Other Two Trees
- UVA10250 The Other Two Trees
- UVA10250 - The Other Two Trees
- UVa10250 – The Other Two Trees
- The Other Two Trees
- The Other Two Trees
- 10250 - The Other Two Trees
- 10250 - The Other Two Trees
- 10250 The Other Two Trees
- 10250 - The Other Two Trees
- uva_10250 - The Other Two Trees
- UVA The Other Two Trees
- uva 10250 - The Other Two Trees
- uva-10250-The Other Two Trees
- Uva 10250 - The Other Two Trees
- SRM 453.5 DIV1 总结
- iOS学习笔记13—iOS框架总结
- 马上着手开发 iOS 应用程序 (Start Developing iOS Apps Today)——程序设计语言
- form单个字段传数组
- 常常忘记的C++基础知识及VS2008的相关操作
- UVA10250-The Other Two Trees
- hdu 4685 (最大匹配+强连通分量)
- 马上着手开发 iOS 应用程序 (Start Developing iOS Apps Today)——基本任务
- [zoj 3551]Bloodsucker[概率DP]
- 马上着手开发 iOS 应用程序 (Start Developing iOS Apps Today)——框架
- 关于黄路对他人进行恶意诋毁!人身攻击!威胁的说明!
- 总结 JSP与 servlet之间的传值
- 数组
- OSPF身份验证