Turn the corner
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 |
|
Sample Output
yes |
|
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的更多相关文章
- Turn the corner (三分)
Turn the corner Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tot ...
- Turn the corner
Problem Description Mr. West bought a new car! So he is travelling around the city. One day he comes ...
- 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) ...
随机推荐
- ACM学习之路___HDU 5723(kruskal + dfs)
Abandoned country Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Submission(s) ...
- 机器视觉----LBP
最近一直在做多视图的聚类与分裂,想要图片有更多的视图,就得对图片的特征进行抽取,那我们来聊聊图片的LBP特征. Local binary patterns (局部二值模式),是机器视觉中重要的一种特征 ...
- Ubuntu 16安装GPU版本tensorflow
pre { direction: ltr; color: rgb(0, 0, 0) } pre.western { font-family: "Liberation Mono", ...
- 非对称加密RSA的C#实现
1.对称加密算法 对称加密是最快速.最简单的一种加密方式,加密(encryption)与解密(decryption)用的是同样的密钥(secret key). 对称加密有很多种算法,由于它效率很高,所 ...
- Java web AJAX入门
一:AJAX简介 AJAX :Asynchronous JavaScript And XML 指异步 JavaScript 及 XML 一种日渐流行的Web编程方式 Better Faster Use ...
- vue + ajax + php 接口的使用小接
vue + ajax + php 接口的使用小接 前端代码: (获取用户信息,并渲染页面) userinfor.html <!DOCTYPE html> <html lang=&qu ...
- 阿里云AliYun表格存储(Table Store)相关案例
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- SpringMVC拦截器Interceptor
SpringMVC拦截器(Interceptor)实现对每一个请求处理前后进行相关的业务处理,类似与servlet中的Filter. SpringMVC 中的Interceptor 拦截请求是通过Ha ...
- 关于AOP装饰函数中的this
在学习关于JavaScript的装饰者设计模式的过程中,发现其实现方式的关键在于this的使用. 想象一个匿名函数(其实预定义的有名函数也可以,都存在引用),其中的this: // 我们先定义一个匿名 ...
- 用git上传代码到新浪云
新浪云空间是国内免费的一个空间,不过有限制很多. 申请新浪云需要新浪账号,注册略. 使用新浪账号去http://sae.sina.com.cn申请一个空间 选择新建应用 可以选择使用php项目 管理应 ...
