Turn the corner--hdu2438(3分法)
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2237 Accepted Submission(s):
859
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.
otherwise.

#include<stdio.h>
#include<math.h>
#define PI 3.1415926535
double l,d,x,y;
double hs(double p)
{
double w;
w=l*sin(p)-x*tan(p)+d/cos(p);//函数,计算h
return w;
}
int main()
{
while(scanf("%lf%lf%lf%lf",&x,&y,&l,&d)!=EOF)
{
double a=,b=PI/,mid,midmid;
do
{
//mid=(b-a)/3+a;
//midmid=(b-a)*2/3+a;
mid=(a+b)/;
midmid=(mid+b)/;
if(hs(mid)>hs(midmid))
b=midmid;
else
a=mid;
}while(b-a>1e-);
if(hs(mid)<y)
printf("yes\n");
else
printf("no\n");
}
return ;
}
Turn the corner--hdu2438(3分法)的更多相关文章
- 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 ...
- 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路!各路大神,以后你们有啥好的简便写法可以在博客下方留个言或私信我,谢谢了! ...
- 将n个东西分成n1,n2,n3,n4,....nr 共 r组分给r个人有多少种分法。
(n!/(n1! *n2! *n3!..nr!) ) * r!/( 同数量组A的数量! 同数量组B的数量!....) 比方20个东西分成2,2,,2,2 3,3,3,3 8组分给8个人有多少种 ...
- 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 ...
- CSP-J2019 把8个同样的球放在同样的5个袋子里,允许有的袋子空着不放,问共有多少种不同的分法?
把8个同样的球放在同样的5个袋子里,允许有的袋子空着不放,问共有多少种不同的分法? 提示:如果8个球都放在一个袋子里,无论是放哪个袋子,都只算同一种分法. 解析: 把问题合成,先思索5个袋子都不空的状 ...
随机推荐
- java 数字补齐0
String str_f = str.substring(0, 1); int i = (Integer.parseInt(str.substring(1)) + 1); // 数字补齐0 Decim ...
- Python之路第十二天,高级(5)-Python操作Mysql,SqlAlchemy
Mysql基础 一.安装 Windows: 1.下载 http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.31-winx64.zip 2.解压 ...
- FatMouse's Speed(HDU LIS)
FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- 动态PDF在线预览
实战动态PDF在线预览及带签名的PDF文件转换 开篇语: 最近工作需要做一个借款合同,公司以前的合同都是通过app端下载,然后通过本地打开pdf文件,而喜欢创新的我,心想着为什么不能在线H5预览,正是 ...
- 十四、职责链(Chain of Responsibility)模式--行为型模式(Behavioral Pattern)
职责链模式是一种对象的行为模式[GOF95].在责任链模式里,很多对象由每一个对象对其下家的引用而连接起来形成一条链.请求在这个链上传递,直到链上的某一个对象决定处理此请求.发出这个请求的客户端并不知 ...
- github page使用
github page介绍: https://help.github.com/categories/20/articles 使用GitHub Pages建立博客 与GitHub建立好链接之后,就可以方 ...
- 转:Dynamic Binding Of RDLC To ReportViewer
Introduction I was struggling to find the solution to bind rdlc dynamically to reportviewer .We had ...
- 常用数据结构及复杂度 array、LinkedList、List、Stack、Queue、Dictionary、SortedDictionary、HashSet、SortedSet
原文地址:http://www.cnblogs.com/gaochundong/p/data_structures_and_asymptotic_analysis.html 常用数据结构的时间复杂度 ...
- 中国版 Ubuntu Kylin 14.04 LTS 麒麟操作系统中文版发布下载 (Ubuntu天朝定制版)
中国版 Ubuntu Kylin 14.04 LTS 麒麟操作系统中文版发布下载 (Ubuntu天朝定制版) http://www.iplaysoft.com/ubuntukylin.html
- poj1001(高精度)
Exponentiation Time Limit: 500MS Memory ...