POJ 2507 Crossed ladders (二分)
来源:互联网 发布:melt it down 编辑:程序博客网 时间:2024/06/04 00:27
Crossed ladders
Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5002 Accepted: 1919
Description
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
Each line of input contains three positive floating point numbers giving the values of x, y, and c.
Output
For each line of input, output one line with a floating point number giving the width of the street in feet, with three decimal digits in the fraction.
Sample Input
30 40 1012.619429 8.163332 310 10 310 10 1
Sample Output
26.0337.0008.0009.798
Source
The UofA Local 2000.10.14
三角函数
#include<stdio.h>#include<string.h>#include<algorithm>#include<math.h>using namespace std;int main(){double x,y,c,a1,a2;int t;int k=1;scanf("%d",&t);while(t--){scanf("%lf%lf%lf",&x,&y,&c);int size=100;double ans;double left=0;double right=min(x,y);while(size--){double mid=(left+right)/2;a1=acos(mid/x);a2=acos(mid/y);if(c/tan(a1)+c/tan(a2)<=mid){ans=mid;left=mid;}elseright=mid;}printf("Case %d: %lf\n",k++,ans);}}
0 0
- POJ 2507 Crossed ladders (二分)
- POJ:2507 Crossed ladders(二分+几何数学)
- poj 2507 crossed ladders(计算几何,二分)
- poj 2507Crossed ladders 计算几何,二分
- poj-2507-Crossed ladders【二分】【计算几何】
- Crossed Ladders(二分)
- poj 2507 Crossed ladders
- POJ-2507 Crossed ladders
- POJ - 2507 Crossed Ladders
- Crossed Ladders(二分+几何)
- POJ 2507 Crossed ladders 笔记
- POJ-2057 Crossed Ladders (二分,数学)
- UVA 10566 && POJ 2507 Crossed Ladders (几何)
- uva 10566 - Crossed Ladders(几何+二分)
- Lightoj 1062 Crossed Ladders (二分)
- uva 10566 Crossed ladders(二分 + 几何)
- 【UVa】10566 - Crossed Ladders(二分 & 数学)
- UVA 10566 Crossed Ladders (几何+二分)
- 利用barcode4j生成条形码
- R语言|文本挖掘应用|标签云
- 顺序表应用1:多余元素删除之移位算法
- [初学]H5+PHP 在线坦克开发日记
- 2016“智能无人系统”暑期学校总结
- POJ 2507 Crossed ladders (二分)
- ue4 创建c++工程失败解决方案
- js获取网站域名
- 常用排序算法--冒泡排序
- Latex 数学公式入门
- Android之ContentProvider的启动过程源码分析
- HDOJ 2141 Can you find it?
- JavaScript深度复制(deep clone)的实现方法
- 解决无法删除表,提示被外键约束引用