Turn the corner
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?
the corner" title="Turn the corner">four real numbers, x, y, l and w.
Proceed to the end of file.
across the corner, print "yes". Print "no" otherwise.
4
4
0ms):
#include
#include
#define pi 3.141592653589793238
using namespace std;
double x,y,l,d;
double cal(double s)//进行三分的条件
{
return
l*cos(s)+(d-x*cos(s))/(sin(s));
//l*cos(s)+(d-x*cos(s))/(sin(s))就是过弯过程中在y方向上的宽
}
main()
{
//freopen("in.txt", "r", stdin);
double
left,right,mid,midmid;
while(scanf("%lf%lf%lf%lf",&x,&y,&l,&d)!=EOF)
{
//printf("x=%.1f y=%.1f l=%.1f d=%.1f\n",x,y,l,d);
if(d>x||d>y)
{
printf("no\n");
continue;
}
left=0;
right=pi/2;//最大只能是pi/2,不可能倒着转弯吧
//printf("left=%.1f right=%.1f\n",left,right);
while (right-left>1e-10)
{
mid=(left+right)/2;
midmid=(mid+right)/2;
//printf("mid=%.4f mid mid=%.4f\n",mid,midmid);
if (cal(mid)>=cal(midmid))//过弯过程中在y方向上的宽,与y比较
right=midmid;
else left=mid;
}
//printf("right=%.1f\n",right);
if(cal(right)>y)//如果最大角度过弯时还是比y宽就肯定过不去
printf("no\n");
else
printf("yes\n");
}
return
0;
}
Turn the corner的更多相关文章
- Turn the corner (三分)
Turn the corner Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tot ...
- Turn the corner
Turn the corner Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tot ...
- HDU 2438 Turn the corner(三分查找)
托一个学弟的福,学了一下他的最简便三分写法,然后找了一道三分的题验证了下,AC了一题,写法确实方便,还是我太弱了,漫漫AC路!各路大神,以后你们有啥好的简便写法可以在博客下方留个言或私信我,谢谢了! ...
- hdu 2348 Turn the corner(三分&&几何)(中等)
Turn the corner Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- hdu 2438 Turn the corner [ 三分 ]
传送门 Turn the corner Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Othe ...
- HDU2438 Turn the corner【三分法】【数学几何】
Turn the corner Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- hdu 2438 Turn the corner(几何+三分)
Problem Description Mr. West bought a new car! So he is travelling around the city. One day he comes ...
- 【三分法】hdu2438 Turn the corner
Problem Description Mr. West bought a new car! So he is travelling around the city.One day he comes ...
- hdu Turn the corner
这题是道三分的题,首先要分析满足条件的情况,这个就是平面几何的功夫了.要想车子能够转弯成功,最上面那个点到水平线的距离要小于等于y.这里h和s的公式就是利用平面几何的知识求出来的:s=l*cos(a) ...
随机推荐
- 线段树+RMQ问题第二弹
线段树+RMQ问题第二弹 上篇文章讲到了基于Sparse Table 解决 RMQ 问题,不知道大家还有没有印象,今天我们会从线段树的方法对 RMQ 问题再一次讨论. 正式介绍今天解决 RMQ 问题的 ...
- HDU-3032
Problem Description Nim is a two-player mathematic game of strategy in which players take turns remo ...
- 西邮linux兴趣小组2014纳新免试题(二)
[第二关] 题目 http://round2.sinaapp.com/ 分析 打开后,戳进去发现一句名言,然后下一戳的url提示. 在网页源码中得到Page1024提示,于是写一个脚本 #!/bin/ ...
- Tomcat启动错误【Error listenerStart】
今天启动Tomcat启动不了,报以下错: org.apache.catalina.core.StandardContext startInternal SEVERE: Error listenerSt ...
- D. How many trees? DP
D. How many trees? time limit per test 1 second memory limit per test 64 megabytes input standard in ...
- MySQL show status 参数详解
状态名 作用域 详细解释 Aborted_clients Global 由于客户端没有正确关闭连接导致客户端终止而中断的连接数 Aborted_connects Global 试图连接到MySQL服务 ...
- Ubuntu访问window下的磁盘分区出现“Error mounting /dev/sda5 at/media”错误的解决方法
我装ubuntu之前,电脑上安装了windows 10,为了装ubuntu,在window 10下的磁盘工具分配了30G的磁盘空间.安装完Ubuntu之后,访问window 10的磁盘分区出现“Err ...
- C#实现断点续传
断点续传的原理在了解HTTP断点续传的原理之前,先来说说HTTP协议,HTTP协议是一种基于tcp的简单协议,分为请求和回复两种.请求协议是由客户机(浏览器)向服务器(WEB SERVER)提交请求时 ...
- Python学习手册 :Python 学习笔记第一天
获取当前目录路径: import os os.getcwd() 在输入python程序时,尽量让不是嵌套结构的语句处于最左侧,要不然系统或许会出现"SyntaxError"错误 获 ...
- Echarts数据可视化grid直角坐标系(xAxis、yAxis),开发全解+完美注释
全栈工程师开发手册 (作者:栾鹏) Echarts数据可视化开发代码注释全解 Echarts数据可视化开发参数配置全解 6大公共组件详解(点击进入): title详解. tooltip详解.toolb ...