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张牌.问最后翻转之后的情况数 思路:对于每一些翻转,假设能确 ...
随机推荐
- fragment的入门DEMO
效果图: 代码如下: 1.main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLay ...
- LeetCode: Longest Consecutive Sequence [128]
[题目] Given an unsorted array of integers, find the length of the longest consecutive elements sequen ...
- HTTP协议之 简易浏览器(3)--转载
简单的说,今天的全部工作就是 我的目的只有两个 1.加深对http协议的理解 2.深化对B/S结构的认识. 代码 1 /* 2 这个程序把主机地址写死了, 3 想更像的话,可以在加个输入.然后根据 ...
- 自由缩放属性-resize(禁止textarea的自由缩放尺寸功能)
resize:none|both|horizontal|vertical|inherit 可以用来改变元素的尺寸大小 用上这个属性后元素的有下脚会有一个小图标 拖它就可以了 但是我把resize:bo ...
- orcl 行转列的存储过程
CREATE or replace PROCEDURE sp_fixWage AUTHID CURRENT_USER as --此处需要注意的 authid current_user 这个属性 详细 ...
- 数学期望和概率DP题目泛做(为了对应AD的课件)
题1: Uva 1636 Headshot 题目大意: 给出一个000111序列,注意实际上是环状的.问是0出现的概率大,还是当前是0,下一个还是0的概率大. 问题比较简单,注意比较大小: A/C & ...
- self和this的不同
在Java和C++中,this总是指的是当前实例地址,而在静态方法也就是类方法中,是不可以使用this的.在Objectvie-C中,self是既可以出现在实例方法中,也可以出现在类方法中,并且在不同 ...
- android 利用重力感应监听 来电时翻转手机后静音。
在CallNotifier.java中 加入如下代码: public void GetSensorManager(Context context) { sm = (SensorManager) ...
- YUI Array 之some(检测|any)
YUI原码 YUI someYArray.some = Lang._isNative(Native.some) ? function (array, fn, thisObj) { return Nat ...
- JavaScript对象(一)——Function对象
写在最前面: 对象只是带有属性和方法的特殊数据类型(js的7种数据类型:字符串,数字,布尔,数组,对象,null,undefined). JavaScript是面向对象的语言,但是JavaScript ...