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. Opengl4.5 中文手册—B

    索引 A      B    C      D     E     F     G H      I     J      K     L     M     N O      P    Q      ...

  2. SSH端口转发详解及实例

    一.SSH端口转发简介 SSH会自动加密和解密所有SSH客户端与服务端之间的网络数据.但是,SSH还能够将其他TCP端口的网络数据通SSH链接来转发,并且自动提供了相应的加密及解密服务.这一过程也被叫 ...

  3. UWP brush

    ---some words---- 1.Alpha:透明度 2.Argb :Alpha red green blue 3.brush: [brʌʃ]    刷子,笔画,笔刷 4.fore 前头 5.F ...

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

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

  5. node.js上除了Express还有哪些好用的web开发框架

    老司机都有体会, 开发本身没有多难, 最纠结其实是最初的技术和框架选型, 本没有绝对的好坏之分, 可一旦选择了不适合于自己业务场景的框架, 将来木已成舟后开发和维护成本都很高, 等发现不合适的时候更换 ...

  6. Block使用的简单总结

    一.Block简单的使用 1.block当作参数来传递 如下定义一个没有返回值无参数的block,并把它作为参数,让系统调用,注意:这里是系统在调用,不是我们调用 那么为什么需要把block当作参数去 ...

  7. 【转】FTP主动模式和被动模式的比较

    总是记不住FTP主动和被动模式的区别.放在这里,以备日后查阅.   FTP是仅基于TCP的服务,不支持UDP.与众不同的是FTP使用2个端口,一个数据端口和一个命令端口(也可叫做控制端口).通常来说这 ...

  8. Spring Boot Starter 介绍

    http://www.baeldung.com/spring-boot-starters 作者:baeldung 译者:http://oopsguy.com 1.概述 依赖管理是任何复杂项目的关键部分 ...

  9. css系列教程1-选择器全解

    全栈工程师开发手册 (作者:栾鹏) 一个demo学会css css系列教程1-选择器全解 css系列教程2-样式操作全解 css选择器全解: css选择器包括:基本选择器.属性选择器.伪类选择器.伪元 ...

  10. springboot自定义配置源

    概述 我们知道,在Spring boot中可以通过xml或者@ImportResource 来引入自己的配置文件,但是这里有个限制,必须是本地,而且格式只能是 properties(或者 yaml). ...