Turn the corner

Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 654 Accepted Submission(s): 291
 
Problem Description
Mr. West bought a new car! So he is travelling around the city.

One day he comes to a vertical corner. The street he is currently in has a width x, the street he wants to turn to has a width y. The car has a length l and a width d.

Can Mr. West go across the corner?

 
Input
Every line has four real numbers, x, y, l and w.
Proceed to the end of file.
 
Output
If he can go across the corner, print "yes". Print "no" otherwise.
 
Sample Input
10 6 13.5 4
10 6 14.5 4
 
Sample Output
yes
no
 
 
Source
2008 Asia Harbin Regional Contest Online
 
Recommend
gaojie
/*
x和y值和题目相反,搞了了好几遍
*/
#include<bits/stdc++.h>
#define exp 1e-9
#define pi acos(-1)
using namespace std;
/*
小车不靠墙壁段的直线方程
*/
double dis(double Q,double l,double d,double x)
{
double b=d/cos(Q)+l*sin(Q);
return (b-x)/tan(Q);
}
int main()
{
//freopen("C:\\Users\\acer\\Desktop\\in.txt","r",stdin);
double x,y,l,d;
while(scanf("%lf%lf%lf%lf",&x,&y,&l,&d)!=EOF)
{
double left=,right=pi/,mid,midmid;
//cout<<right<<endl;
while(right-left>exp)
{
mid=left+(right-left)/;
midmid=right-(right-left)/;
//假设求解最大极值.
if(dis(mid,l,d,x)>=dis(midmid,l,d,x))
right=midmid;
else
left=mid;
}
//cout<<"mid="<<mid<<endl;
//cout<<(int)dis(mid,l,d,x)<<endl;
if(dis(mid,l,d,x)<y)
puts("yes");
else
puts("no");
}
return ;
}

Turn the corner的更多相关文章

  1. Turn the corner (三分)

    Turn the corner Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tot ...

  2. Turn the corner

    Problem Description Mr. West bought a new car! So he is travelling around the city. One day he comes ...

  3. HDU 2438 Turn the corner(三分查找)

    托一个学弟的福,学了一下他的最简便三分写法,然后找了一道三分的题验证了下,AC了一题,写法确实方便,还是我太弱了,漫漫AC路!各路大神,以后你们有啥好的简便写法可以在博客下方留个言或私信我,谢谢了! ...

  4. hdu 2348 Turn the corner(三分&amp;&amp;几何)(中等)

    Turn the corner Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  5. hdu 2438 Turn the corner [ 三分 ]

    传送门 Turn the corner Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Othe ...

  6. HDU2438 Turn the corner【三分法】【数学几何】

    Turn the corner Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  7. hdu 2438 Turn the corner(几何+三分)

    Problem Description Mr. West bought a new car! So he is travelling around the city. One day he comes ...

  8. 【三分法】hdu2438 Turn the corner

    Problem Description Mr. West bought a new car! So he is travelling around the city.One day he comes ...

  9. hdu Turn the corner

    这题是道三分的题,首先要分析满足条件的情况,这个就是平面几何的功夫了.要想车子能够转弯成功,最上面那个点到水平线的距离要小于等于y.这里h和s的公式就是利用平面几何的知识求出来的:s=l*cos(a) ...

随机推荐

  1. (一) .net core 2.0 初体验

    1..net core 2.0环境 .net core 下载地址:https://www.microsoft.com/net/core#windowscmd 问题一:提示[Failed to load ...

  2. POJ(1195)(单点修改,区间查询)(二维)

    题目大意 给定一个N*N的网格,刚开始每个网格的值都是0,接下来会对这些网格进行操作,有一下两种操作: 1."X Y A"对网格C[x][y]增加A 2."L B R T ...

  3. 怎样学好哲学(lucas+费马小定理)

    怎样学习哲学 时间限制: 1 Sec  内存限制: 128 MB提交: 97  解决: 27[提交][状态][讨论版] 题目描述 OI大师抖儿在夺得银牌之后,顺利保送pku.这一天,抖儿问长者:&qu ...

  4. Python协程深入理解

    从语法上来看,协程和生成器类似,都是定义体中包含yield关键字的函数.yield在协程中的用法: 在协程中yield通常出现在表达式的右边,例如:datum = yield,可以产出值,也可以不产出 ...

  5. Iframe刷新页面

    window.parent.frames["name"].location="url";

  6. java人员正确使用IDEA 的方式

    博主是Java开发人员,以前一直都用myeclipse来开发的,说实话感觉myeclipse毫无美感可言,后来经过同事介绍,认识了IDEA,一眼就相中了IDEA黑色的主题风格,自此就抛弃了旧爱myec ...

  7. Linux-jdk1.7-tomcat7 简易安装

    一.jdk 安装 安装包:jdk-7u80-linux-x64.tar.gz 2 解压 [root@localhost package]# tar -zxvf jdk-7u80-linux-x64.t ...

  8. FPGA与数字信号处理

    过去十几年,通信与多媒体技术的快速发展极大地扩展了数字信号处理(DSP)的应用范围.眼下正在发生的是,以更高的速度和更低的成本实现越来越复杂的算法,这是针对高级信息服更高带宽以及增强的多媒体处理能力等 ...

  9. java web jsp原理图 ,静态包含,动态包含,out与response.getWrite()

    jsp原理图 ,静态包含,动态包含,out与response.getWrite() 

  10. bootstrap 轮播模板

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...