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个袋子都不空的状 ...
随机推荐
- Ecstore中的微信支付怎么样配置
要在Ecstore中开启微信支付,需要先在后台/应用中心中安装“移动商城”和“微信商城管理”这两个App移动商城App是ecstore的手机wap版,可在手机浏览器中实现商城的B2c购物功能.“微信商 ...
- php 查看文档
http://www.runoob.com/php/php-datatypes.html php 学习网站 : http://www.phpfans.net/
- ArcGis API FOR Silverlight 做了个导航工具~
原文 http://www.cnblogs.com/thinkaspx/archive/2012/08/08/2628214.html 转载请注明文章出处:http://www.cnblogs.com ...
- Unix/Linux环境C编程入门教程(37) shell常用命令演练
cat命令 cat命令可以用来查看文件内容. cat [参数] 文件名. grep-指定文件中搜索指定字符内容. Linux的目录或文件. -path '字串' 查找路径名匹配所给字串的所有文件 ...
- Jquery时间验证和转换工具
var TimeObjectUtil; /** * @title 时间工具类 * @note 本类一律违规验证返回false * @author {boonyachengdu@gmail.com} * ...
- 【剑指offer】面试题22:栈的压入、弹出序列
题目: 输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否为该栈的弹出顺序.假设压入栈的所有数字均不相等.例如序列1,2,3,4,5是某栈的压入顺序,序列4,5,3,2,1是该压栈序列 ...
- Java专项面试训练(一)
1.在Java中,( )类提供定位本地文件系统,对文件或目录及其属性进行基本操作( D ) A.FileInputStream B.FileReader C.FileWriter D.File解析:F ...
- rsync常用参数详解
rsync常用参数详解 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 在linux中,一切皆是文件,包括你的终端,硬件设备信息,目录,内核文件等等.所以工作中我们难免会遇到拷贝文件 ...
- 两分钟让你明白cocos2dx的屏幕适配策略
闲来无事,整理了一下cocos2dx的屏幕适配策略,本文适用于想快速理解cocos2dx适配的开发者. 我们先假设:以854 * 480 的屏幕为标准进行开发,当然,这也就是cocos2dx所说的设计 ...
- 16进制字符串转换为byte数组
/// <summary> /// 16进制字符转换为byte数组 /// </summary> /// <param name="hexString" ...