高中几何题

A narrow street is lined with tall buildings. An x foot long ladder is rested at the base of the building on the right side of the street and leans on the building on the left side. A y foot long ladder is rested at the base of the building on the left side of the street and leans on the building on the right side. The point where the two ladders cross is exactly c feet from the ground. How wide is the street?

Input

Input starts with an integer T (≤ 10), denoting the number of test cases.

Each test case contains three positive floating point numbers giving the values of xy, and c.

Output

For each case, output the case number and the width of the street in feet. Errors less than 10-6 will be ignored.

Sample Input

4

30 40 10

12.619429 8.163332 3

10 10 3

10 10 1

Sample Output

Case 1: 26.0328775442

Case 2: 6.99999923

Case 3: 8

Case 4: 9.797958971

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const int maxx=127;
const double esp=1e-10;char ch[40];
int main()
{double x,y,c,l,t,r;int T;cin>>T;double mid;int cnt=0;while(T--){cin>>x>>y>>c;l=0.0;r=min(x,y);while(r-l>esp){mid=(l+r)/2.00;t=mid;double a1=c/sqrt(y*y-t*t);double b1=c/sqrt(x*x-t*t);double p=a1+b1-1;// printf("%.7lf\n",t);if(abs(p)<esp){printf("Case %d: %.7lf\n",++cnt,t);break;}else if(p<=0){l=mid;// l=mid+esp}elser=mid; // r=mid+esp}}return 0;
}
// 9474  8379 6329

Crossed Ladders 计算几何相关推荐

  1. 计算几何(二分) - Crossed Ladders - UVA 10566

    计算几何(二分) - Crossed Ladders - UVA 10566 题意: 如上图,给定三个浮点数x,y,c,计算两个房子之间的间距.如上图,给定三个浮点数x,y,c,计算两个房子之间的间距 ...

  2. POJ2507 Crossed ladders

    POJ2507 Crossed ladders 本题复习实数域上的二分. 实数域上的二分与普通的二分不同,它需要设置一个精度,据题目而定(一般不会小于1e-9). 本题首先推公式,由相似三角形其实可以 ...

  3. UVA10566 Crossed Ladders(计算几何+二分)

    有两把梯子搭在墙上,给出这两把梯子的长度 x,y,以及他们的交点,交点的高度为 h,求这两个房屋之间的距离 如上图所示,易证红色内有两个三角形相似和绿色内有两个三角形相似 所以有: double x, ...

  4. Crossed ladders

    第 2326 题  :  (时间限制为:1000毫秒) Description A narrow street is lined with tall buildings. An x foot long ...

  5. poj 2507Crossed ladders 计算几何

    链接:http://poj.org/problem?id=2507 题意:哪个直角三角形,一直角边重合, 斜边分别为 X, Y, 两斜边交点高为 C , 求重合的直角边长度~ 思路: 设两个三角形不重 ...

  6. 【Uva10566】Crossed Ladders

    列出一个包含x,y,c的关系式,设宽为w,底边垂线左边为a,根据相似三角形关系: 1.a/w=c/sqrt(y*y-w*w); 2.(w-a)/w=c/sqrt(y*y-w*w); 两式合并消去a得: ...

  7. Lightoj 1062 Crossed Ladders (二分)

    题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1062 题意:两根棍子斜放在墙上,给你棍子的长度和他们交点距离地面的高度 ,求两 ...

  8. UVa 10566 - Crossed Ladders

    设宽度为w,二分w. 1 #include <cstdio> 2 #include <cmath> 3 #include <algorithm> 4 5 #defi ...

  9. HOJ题目分类//放这儿没事刷刷学算法!嘻嘻!

    各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1 ...

最新文章

  1. 利用HAProxy实现零停机更新维护
  2. CentOS上 Mono 3.2.8运行ASP.NET MVC4经验
  3. JAVA程序员面试总结,高手整理加强版
  4. mysql之查询排序
  5. ipqc的工作流程图_IPQC流程图
  6. latex 错误: BibTeX: empty journal in Lv2021
  7. POJ 3087 Shuffle'm Up(水题)
  8. 【美团外卖】美食知识图谱的迭代及应用
  9. Python 高级编程笔记之测试驱动开发
  10. 微信转账2020假图片_微信头像图片2020独一无二
  11. C# MVC获取微信openId
  12. Centos7查看硬盘容量
  13. json在线解析(json在线解析)
  14. ​LeetCode刷题实战510:二叉搜索树中的中序后继 II
  15. 奶瓶(beini) 又一蹭网神器 1.2.2增强版带600万密码字典
  16. ffmpeg生成透明背景视频
  17. moment的常见用法总结
  18. 递增有序顺序表的插入 (20分) 实验目的:1、掌握线性表的基本知识 2、深入理解、掌握并灵活运用线性表。3、熟练掌握线性表的存储结构及主要运算的实现 已知顺序表L递增有序,将X插入到线性表的适当位置
  19. 按键式计算器——人机交互的变革
  20. 论文笔记-Optimized flocking of autonomous drones in confined environments

热门文章

  1. java 全站静态化_java如何页面全站静态化
  2. PPT怎么才能播放时候看备注
  3. su、sudo、sudo su、sudo -i sudo -l的用法和区别
  4. Oracle查询数据,其中指定字段重复的只取其中一条
  5. 详解叠瓦式磁记录SMR盘基础知识
  6. 求次数不大于5的不可约多项式
  7. [原创]Android x86开启houdini(arm兼容库) 手动安装houdini 支持arm app
  8. c语言/c++转Java学习笔记---基础问题
  9. 翻译连载: 第1篇 计算机编程的结构与解释 目录
  10. 如何删除计算机某个盘搜索记录,怎么快速删除搜索记录 如何随意删除指定的那条记录...