hdu 2438Turn the corner 三分
Turn the corner
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2785 Accepted Submission(s): 1102
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?
Proceed to the end of file.
10 6 14.5 4
no
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <queue>
#include <cmath>
using namespace std;
double x,y,l,w;
const double pi=acos(-1.0);
const double eps=1e-7;
double cal(double a)
{
double k=x-l*sin(a)-w/cos(a);
return -k/tan(a);
}
int main()
{
while(scanf("%lf%lf%lf%lf",&x,&y,&l,&w)!=EOF)
{
double l=0.0,r=pi/2;
if(x<=w|| y<=w) {printf("no\n");continue;}
while(l+eps<=r)
{
double mid=(l+r)/2.0;
double mmid=(mid+r)/2.0;
if(cal(mid)<=cal(mmid)) l=mid;
else r=mmid;
}
if(cal(r)<y) printf("yes\n");
else printf("no\n");
}
return 0;
}
hdu 2438Turn 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) ...
- nyoj 1029/hdu 3714 Error Curves 三分
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3714 懂了三分思想和F(x)函数的单调性质,这题也就是水题了 #include "stdio ...
- hdu 3714 Error Curves(三分)
http://acm.hdu.edu.cn/showproblem.php?pid=3714 [题意]: 题目意思看了很久很久,简单地说就是给你n个二次函数,定义域为[0,1000], 求x在定义域中 ...
- hdu Turn the corner
这题是道三分的题,首先要分析满足条件的情况,这个就是平面几何的功夫了.要想车子能够转弯成功,最上面那个点到水平线的距离要小于等于y.这里h和s的公式就是利用平面几何的知识求出来的:s=l*cos(a) ...
- Turn the corner (三分)
Turn the corner Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tot ...
- HDU 2298 Toxophily(公式/三分+二分)
Toxophily Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- HDU题解索引
HDU 1000 A + B Problem I/O HDU 1001 Sum Problem 数学 HDU 1002 A + B Problem II 高精度加法 HDU 1003 Maxsu ...
随机推荐
- uva12486 Space Elevator(数位dp)
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud 题目链接:https://uva.onlinejudge.org/index.ph ...
- Zepto源码笔记(三)
ps:本文中"组装成成数组"指的是若元素个数大于1则返回数组,若元素只有1个则返回元素本身 以下函数是$.fn该对象的方法 ready(callback) 通过readyRE正则表 ...
- python类方法与对象方法学习
class Test_Demo: TEST = 'test_value' def __init__(self,name,age): self.name = name self.age = age #s ...
- DESTOON系统文章模块默认设置第一张图片为标题图的方法
连上FTP或者其他方法打开网站目录下的\module\article\admin\template\edit.tpl.php修改设置内容第 <input name="post[thum ...
- vector容器
vector<int> ivec; vector<Sales_item> Sales_vec; 和其他变量定义一样,定义 vector 对象要指定类型和一个变量的列表.上 面的 ...
- javascript中的一些基本方法收藏
W3C DOM 什么是DOM,DOM其实就是把一个HTML或者XML等符合W3C标准的文档内容模拟成一个JAVA对象,这样才能给JAVA或者JS来操作.下面是JS中模拟出的内置DOM对象documen ...
- 策略模式 - OK
策略模式(Strategy):它定义了算法家族,分别封装起来,让他们之间可以互相替换,此模式让算法的变化不会影响到使用算法的客户. 策略模式是一种定义一系列算法的方法,从概念上来看,所有这些算法完成的 ...
- error recoder,error debug for openStack kilo
- cocos2d-x ios 设置横屏/竖屏(全)
Cocos2d-x项目\iOS\RootViewController.mm文件中. 以下方法任选其一即可… 本人机子函数二ok! 函数一: (BOOL)shouldAutorotateToI ...
- vi高级技巧
本文一般情况下用<c-字母>(里边的字母一般大小写无所谓,除非特别注明)表示按住ctrl同时按下相关字母,命令前加一个i 表示在插入模式下用这个命令 1. 选定文字/ 拷贝粘贴 v 为可视 ...