hdu 2438 Turn the corner(几何+三分)
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?

Every line has four real numbers, x, y, l and w.
Proceed to the end of file.
If he can go across the corner, print "yes". Print "no" otherwise.
13.5
14.5
yes
no
mid1=(low+high)/;
mid2=(mid1+high)/;
double mid1=(2*low+high)/3;
double mid2=(low+2*high)/3;
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<bitset>
#include<map>
#include<vector>
#include<stdlib.h>
#include <stack>
using namespace std;
int dirx[]={,,-,};
int diry[]={-,,,};
#define PI acos(-1.0)
#define max(a,b) (a) > (b) ? (a) : (b)
#define min(a,b) (a) < (b) ? (a) : (b)
#define ll long long
#define eps 1e-10
#define MOD 1000000007
#define N 1000000
#define inf 1<<26 double x,y,l,w;
double equ(double t)
{
return l*cos(t)+(w-x*cos(t))/sin(t);
}
int main()
{ while(scanf("%lf%lf%lf%lf",&x,&y,&l,&w)==){
double low=;
double high=PI/2.0;
// double mid1=(low+high)/2;
//double mid2;
double sum1;
double sum2;
while(high-low>eps){
double mid1=(*low+high)/;//要这样找mid
double mid2=(low+*high)/;//要这样找mid
sum1=equ(mid1);
sum2=equ(mid2);
if(sum1<sum2){
low=mid1;
}
else{
high=mid2;
} }
if(equ(low)<=y){
printf("yes\n");
}
else{
printf("no\n");
} }
return ;
}
hdu 2438 Turn the corner(几何+三分)的更多相关文章
- HDU 2438 Turn the corner(三分查找)
托一个学弟的福,学了一下他的最简便三分写法,然后找了一道三分的题验证了下,AC了一题,写法确实方便,还是我太弱了,漫漫AC路!各路大神,以后你们有啥好的简便写法可以在博客下方留个言或私信我,谢谢了! ...
- hdu 2438 Turn the corner [ 三分 ]
传送门 Turn the corner Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Othe ...
- hdu 2348 Turn the corner(三分&&几何)(中等)
Turn the corner Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- HDU2438:Turn the corner(三分)
传送门 分析 根据这张图,我们只要使得h<=y即可,可以发现h是一个凸函数,故使用三分,具体见代码 代码 #include<cstdio> #include<cstring&g ...
- codeforces 782B The Meeting Place Cannot Be Changed+hdu 4355+hdu 2438 (三分)
B. The Meeting Place Cannot Be Change ...
- HDU2438 Turn the corner【三分法】【数学几何】
Turn the corner Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- 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 4869 Turn the pokers(推理)
HDU 4869 Turn the pokers 题目链接 题意:给定n个翻转扑克方式,每次方式相应能够选择当中xi张进行翻转.一共同拥有m张牌.问最后翻转之后的情况数 思路:对于每一些翻转,假设能确 ...
随机推荐
- WEB程序会话管理--HttpSession和Cookie
WEB应用的会话管理的原理: 由于WEB应用的请求和响应是基于HTTP的,而HTTP由属于无状态的通信协议,只能记录本次请求的信息,因此服务器不会记住这一次的请求和下一次请求的关系.所以会话管理的原理 ...
- SpringMVC(二)——流程控制
SpringMVC主要就是用来做流程控制的,这篇博客总结一下如何在流程控制添加Interceptor(拦截器),如何将进行流程Mapping映射解析,如何编写Controller(控制器). 一,首先 ...
- xutils的HttpUtils,Post和Get基本使用,以及BitmapUtils的简单使用
开篇报错注意:本教程是基于xUtils-2.6.14.jar版本实现的 由于studio中6.0以后安卓取消了httpclient,而xutils则基于httpclient开发的,所以现在无法使用,将 ...
- VS2015预览版中的C#6.0 新功能(一)
VS2015预览版中的C#6.0 新功能(二) VS2015预览版中的C#6.0 新功能(三) VS2015的预览版在11月12日发布了,下面让我们来看看C#都提供了哪些新的功能. 字符串添写(Str ...
- (原)Opencv中直方图均衡和图像动态范围拉伸的代码
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5102032.html 参考网址: http://blog.csdn.net/abcjennifer/a ...
- LP64是什么意思
在64位机器上,如果int是32位,long是64位,pointer也是64位,那么该机器就是LP64的,其中的L表示Long,P表示Pointer,64表示Long和Pointer都是64位的.由于 ...
- 【solr基础教程之二】索引
一.向Solr提交索引的方式 1.使用post.jar进行索引 (1)创建文档xml文件 <add> <doc> <field name="id"&g ...
- 通过meteor实现的一个照片墙
always love tech 初次使用meteor所遇到的一个问题: insert failed: Method '/pictures/insert' not found 提示没有这个方法,然后可 ...
- 通过js引入当前所需要的js,css等
在我们web前端页面中经常会用到许多外部的js,css文件,那么问题来了,怎样才能一次性引入? 通过js便可实现 走码: //创建一个init.js文件 var jsUrls = "js/j ...
- 前端开发者使用JS框架的三个等级
目前前端开发者使用JS框架是种很普遍的现象,因为框架可以加快开发速度,同时避免各类浏览器的兼容性问题.不过同样是用框架开发,不同开发者的境界水平还是有一定差距,本文将这些前端开发者分为三个等级. 第一 ...