Turn the corner
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?
the corner" title="Turn the corner">four real numbers, x, y, l and w.
Proceed to the end of file.
across the corner, print "yes". Print "no" otherwise.
4
4
0ms):
#include
#include
#define pi 3.141592653589793238
using namespace std;
double x,y,l,d;
double cal(double s)//进行三分的条件
{
return
l*cos(s)+(d-x*cos(s))/(sin(s));
//l*cos(s)+(d-x*cos(s))/(sin(s))就是过弯过程中在y方向上的宽
}
main()
{
//freopen("in.txt", "r", stdin);
double
left,right,mid,midmid;
while(scanf("%lf%lf%lf%lf",&x,&y,&l,&d)!=EOF)
{
//printf("x=%.1f y=%.1f l=%.1f d=%.1f\n",x,y,l,d);
if(d>x||d>y)
{
printf("no\n");
continue;
}
left=0;
right=pi/2;//最大只能是pi/2,不可能倒着转弯吧
//printf("left=%.1f right=%.1f\n",left,right);
while (right-left>1e-10)
{
mid=(left+right)/2;
midmid=(mid+right)/2;
//printf("mid=%.4f mid mid=%.4f\n",mid,midmid);
if (cal(mid)>=cal(midmid))//过弯过程中在y方向上的宽,与y比较
right=midmid;
else left=mid;
}
//printf("right=%.1f\n",right);
if(cal(right)>y)//如果最大角度过弯时还是比y宽就肯定过不去
printf("no\n");
else
printf("yes\n");
}
return
0;
}
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
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路!各路大神,以后你们有啥好的简便写法可以在博客下方留个言或私信我,谢谢了! ...
- 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) ...
随机推荐
- C/C++ 进程通讯(命名管道)
服务端代码: // pipe_server.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <stdio.h> ...
- Maven在Windows中的配置以及IDE中的项目创建
Maven在Windows下的配置 1.Maven下载地址:http://maven.apache.org/download.cgi,下载红框里的版本即可. 2.解压到D盘: 3.修改配置文件sett ...
- 【Kafka】
KafkaProducer Kafka消息发布客户端. 线程安全,跨线程共享单个生产者实例通常比拥有多个实例的速度更快. 例子,使用生产者发送包含序列号的字符串作为键/值对的记录: Propertie ...
- http://codeforces.com/contest/536/problem/B
B. Tavas and Malekas time limit per test 2 seconds memory limit per test 256 megabytes input standar ...
- PIC32MZ 通过USB在线升级 -- USB HID bootloader
了解 bootloader 的实现, 请加QQ: 1273623966(验证填bootloader); 欢迎咨询或定制bootloader; 我的博客主页 www.cnblogs.com/geekyg ...
- spring cloud+dotnet core搭建微服务架构:Api网关(三)
前言 国庆假期,一直没有时间更新. 根据群里面的同学的提问,强烈推荐大家先熟悉下spring cloud.文章下面有纯洁大神的spring cloud系列. 上一章最后说了,因为服务是不对外暴露的,所 ...
- FTP基本操作类大全,外加c#基础公共帮助类
总结平时用到的一些FTP操作类,方便需要的用到.github地址:https://github.com/Jimmey-Jiang/Common.Utility 1.连接FTP服务器 /// <s ...
- 我修改的时钟flash
<object type="application/x-shockwave-flash" style="outline:none;" data=" ...
- List之Union(),Intersect(),Except() 即并集,交集,差集运算。
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- springboot scheduled并发配置
本文介绍如何使用springboot的sheduled实现任务的定时调度,并将调度的任务实现为并发的方式. 1.定时调度配置scheduled 1)注册定时任务 package com.xiaoju. ...