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张牌.问最后翻转之后的情况数 思路:对于每一些翻转,假设能确 ...
随机推荐
- hdu 5676 ztr loves lucky numbers(dfs+离线)
Problem Description ztr loves lucky numbers. Everybody knows that positive integers are lucky if the ...
- java框架BeanUtils及路径问题练习
内省----->一个变态的反射 BeanUtils主要解决 的问题: 把对象的属性数据封装 到对象中. 使从文件中读取的数据往对象中赋值更加简单: BeanUtils的好处: 1. ...
- 配置数据库连接池,Tomcat6.0 连接池的配置
Tomcat6.0 连接池的配置1.本人当前使用的Tomcat版本为:6.0.20,oracle为稳定的9i版本 2.下文为方便起见,依习惯以%Tomcat_Home%表示Tomcat安装的目录,本人 ...
- POJ 1469 ZOJ1140 二分匹配裸题
很裸,左点阵n,右点阵m 问最大匹配是否为n #include <cstdio> #include <cstring> #include <vector> usin ...
- apache访问控制设置
apache访问控制设置 (2009-03-17 11:24:36) 转载▼ 标签: it 杂谈 Order allow,deny 默认情况下禁止所有客户机访问 Order deny,all ...
- MATLAB快速注释方法
觉得有用,未免以后忘记,收藏了.原文来自:http://i.azpala.com/2008/09/18/matlab-multi-line-comment/ A. %{ 若干语句 %} B. 多行注释 ...
- 是什么让我想到开发NFinal
我是从01前开始就接触.net,那时.net还是1.0时代,很多东西都没有.后来.net出了2.0版本.从vs2005开始就使用Webform做网站.当时感觉.net能够拖来拖去,很厉害.参加工作后, ...
- .net对象转Datable
public static DataTable GetDataTable<T>( IEnumerable<T> list,string tableName) { DataTab ...
- PHP学习笔记二十四【Get Set】
<?php Class Person{ private $n1; private $n2; private $n3; //使用__set方法来管理所有的属性 public function __ ...
- 对 Xcode 菜单选项的详细探索(干货)
http://www.cocoachina.com/ios/20151204/14480.html