链接:http://poj.org/problem?id=2507

题意:哪个直角三角形,一直角边重合, 斜边分别为 X, Y, 两斜边交点高为 C , 求重合的直角边长度~

思路: 设两个三角形不重合的两条直角边长为 a , b,根据 三角形相似, 则有 1/a + 1/b =1/c, 二分枚举答案得之~

 #include <cstdio>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
double x, y, c;
const double eps=1e-;
double get( double p )
{
return 1.0/sqrt( x*x-p*p ) + 1.0/sqrt( y*y-p*p );
}
int main( )
{
while( scanf("%lf%lf%lf", &x, &y, &c)!= EOF ){
double l=, r=min( x, y ), mid;
while( l<r ){
mid=(l+r)/;
if( get(mid) > 1.0/c )
r=mid-eps;
else if( get(mid) < 1.0/c )
l=mid+eps;
else break;
}
printf("%.3f\n", mid);
}
return ;
}

poj 2507Crossed ladders <计算几何>的更多相关文章

  1. POJ 1410 Intersection (计算几何)

    题目链接:POJ 1410 Description You are to write a program that has to decide whether a given line segment ...

  2. POJ 1106 Transmitters(计算几何)

    题目链接 切计算几何,感觉计算几何的算法还不熟.此题,枚举线段和圆点的直线,平分一个圆 #include <iostream> #include <cstring> #incl ...

  3. TOYS - POJ 2318(计算几何,叉积判断)

    题目大意:给你一个矩形的左上角和右下角的坐标,然后这个矩形有 N 个隔板分割成 N+1 个区域,下面有 M 组坐标,求出来每个区域包含的坐标数.   分析:做的第一道计算几何题目....使用叉积判断方 ...

  4. POJ 1654 Area 计算几何

    #include<stdio.h> #include<string.h> #include<iostream> #include<math.h> usi ...

  5. A - TOYS(POJ - 2318) 计算几何的一道基础题

    Calculate the number of toys that land in each bin of a partitioned toy box. 计算每一个玩具箱里面玩具的数量 Mom and ...

  6. POJ 2254 Globetrotter (计算几何 - 球面最短距离)

    题目链接:POJ 2254 Description As a member of an ACM programming team you'll soon find yourself always tr ...

  7. poj 2318 TOYS(计算几何 点与线段的关系)

    TOYS Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 12015   Accepted: 5792 Description ...

  8. POJ 3304 Segments(计算几何)

    意甲冠军:给出的一些段的.问:能否找到一条直线,通过所有的行 思维:假设一条直线的存在,所以必须有该过两点的线,然后列举两点,然后推断是否存在与所有的行的交点可以是 代码: #include < ...

  9. POJ 2318 TOYS(计算几何)

    跨产品的利用率推断点线段向左或向右,然后你可以2分钟 代码: #include <cstdio> #include <cstring> #include <algorit ...

随机推荐

  1. Drupal8开发教程:认识.info.yml文件

    YAML 文件是新引入的重要项目文件,在 Drupal 8 中,无论是模块.主题还是安装配置文件,都需要 .info.yml 文件来为其存储项目相关的基础信息. 在 Drupal 中,.info.ym ...

  2. 使用AS3.0代码实现给图片添加滤镜的模糊与斜角效果

    滤镜可应用于任何显示对象(即,从 DisplayObject 类继承的对象), 例如 MovieClip.SimpleButton.TextField 和 Video 对象,以及 BitmapData ...

  3. the error code is 2203

    权限不够 切换管理员再操作

  4. gem5 运行x86全系统仿真

    使用gem5可以启动Linux内核,称为全系统模拟,启动之后,可以通过telent连接,进行访问,但四telent有时不稳定,gem5推荐使用m5term进行连接访问,整个步骤如下: (1)打开终端, ...

  5. 输出1——n的排列(深度优先搜索)

    样例输入: 3 样例输出: 123132213231312321 #include <stdio.h> int n; void dfs(int step,int* a,int* book) ...

  6. Oracle 学习系列之二(会话与事务级临时表和dual表 )

    一. 会话临时表 --创建会话临时表create global temporary table tmp_user_session(user_id int, user_name varchar2(20) ...

  7. CSS常用布局整理(二)

    1-2-1单列变宽布局 side列定宽300px,content列变宽,尺寸是100%-300px.核心的问题就是浮动列的宽度应该等于“100% - 300px”,而CSS显然不支持这种带有减法运算的 ...

  8. 开源项目:DolphinPlayer

    Dolphin Player是一款基于FFmpeg解码视频播放器,支持大多数的音频和视频格式. 项目主页:http://code.google.com/p/dolphin-player/ 源代码Git ...

  9. thinkphp数据库添加表单提交的数据

    $data['catename'] = I('catename');     获取表单的数据 $cate=D('cate');                               实例化cat ...

  10. 使用javascript取得网站的根路径

    //Javascript获取站点获得根目录绝对路径 function getRootPath() { //完整路径 var strFullPath = window.document.location ...