poj 2507Crossed ladders <计算几何>
链接: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 <计算几何>的更多相关文章
- POJ 1410 Intersection (计算几何)
题目链接:POJ 1410 Description You are to write a program that has to decide whether a given line segment ...
- POJ 1106 Transmitters(计算几何)
题目链接 切计算几何,感觉计算几何的算法还不熟.此题,枚举线段和圆点的直线,平分一个圆 #include <iostream> #include <cstring> #incl ...
- TOYS - POJ 2318(计算几何,叉积判断)
题目大意:给你一个矩形的左上角和右下角的坐标,然后这个矩形有 N 个隔板分割成 N+1 个区域,下面有 M 组坐标,求出来每个区域包含的坐标数. 分析:做的第一道计算几何题目....使用叉积判断方 ...
- POJ 1654 Area 计算几何
#include<stdio.h> #include<string.h> #include<iostream> #include<math.h> usi ...
- A - TOYS(POJ - 2318) 计算几何的一道基础题
Calculate the number of toys that land in each bin of a partitioned toy box. 计算每一个玩具箱里面玩具的数量 Mom and ...
- POJ 2254 Globetrotter (计算几何 - 球面最短距离)
题目链接:POJ 2254 Description As a member of an ACM programming team you'll soon find yourself always tr ...
- poj 2318 TOYS(计算几何 点与线段的关系)
TOYS Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 12015 Accepted: 5792 Description ...
- POJ 3304 Segments(计算几何)
意甲冠军:给出的一些段的.问:能否找到一条直线,通过所有的行 思维:假设一条直线的存在,所以必须有该过两点的线,然后列举两点,然后推断是否存在与所有的行的交点可以是 代码: #include < ...
- POJ 2318 TOYS(计算几何)
跨产品的利用率推断点线段向左或向右,然后你可以2分钟 代码: #include <cstdio> #include <cstring> #include <algorit ...
随机推荐
- Linux下程序对拍_C++
此博客需要付费才阅读,因为该博客实用性十分强,且十分容易理解 若需购买请联系博主,联系方式戳这 http://www.cnblogs.com/hadilo/p/5932395.html 主要介绍如何在 ...
- [mysq]ERROR 2006 (HY000) at line xx: MySQL server has gone away 解决方法
vi /etc/my.cnf wait_timeout=2880000interactive_timeout = 2880000max_allowed_packet = 100M 完整配置文件 [my ...
- 如何在MAC机器中实现移动设备WiFI上网(没有专门的无线路由器的情况)
在很多办公室甚至家中都有无线路由器以方便通过WIFI信号上网.如果没有无线路由器,如何让多个移动智能终端同时上网呢?如果你是Windows用户那么可以选择wifi共享精灵来解决,如果你拥有MAC机器, ...
- Alfresco安装与配置图解
Alfresco安装与配置图解 Alfresco是一款开源的企业内容管理系统(ECM),为企业提供了日常的文档管理.工作流(可以和企业目前的OA协同接合使用).工作记录管理.知识管理.网络内容管理.图 ...
- [AngularJS 1] Introduction to AngularJS
introduction:this article is going to introduce AngularJS in generally. I will write it through five ...
- C/C++中几种操作位的方法
参考How do you set, clear and toggle a single bit in C? c/c++中对二进制位的操作包括设置某位为1.清除某位(置为0).开关某位(toggling ...
- def
a = 97,A = 65,z = 122,Z = 90 小写字母比大写字母整形数值高,upper->lower相差32 把小写字母转化成大写字母,将小写字母 - 32 1. typedef 数 ...
- WWF3自定义活动<第八篇>
WWF提供了对原有活动进行扩展以及自定义新活动的功能,用户可以通过"Workflow Activity Library"创建和开发自定义活动. 一.自定义活动类型 默认情况下,创建 ...
- [转载]:Endnote 自定义style文件的默认位置
一般而言,安裝完EndNote 後,預設Output Styles.Filters.Connection Files 的電腦存放路徑如下– C:\Program Files\EndNote X4 ...
- 五、用户数据报传输(UDP)
1.UDP常用的发送和接收函数 int recvfrom(int sockfd,void *buf,int len,unsigned int flags,struct sockaddr *from,i ...