1.1005
2.
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? Input four real numbers, x, y, l and w. Output If he can go across the corner, print "yes". Print "no" otherwise. Sample Input 10 6 13.5 4 10 6 14.5 4 Sample Output yes no
3.西先生买了一辆新车在城市旅行。
一天,他来到一个垂直的角落。他目前在街上有一个宽度×,他要转的街有一个宽度。这辆车有一个长度和宽度。
西先生能走到拐角吗?
4.
以车长为玄长,画四分之一圆,以此圆心为圆心,此圆半径减去车宽为半径再画四分之一圆。如果路拐角小圆之内,为yes,否则为no,如图:
5.
#include<iostream>
#include<string.h>
#include<set>
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
double PI=acos(-1.0);
double s,h,l,w,x,y;
double car(double a)
{
s=l*cos(a)+w*sin(a)-x;
h=s*tan(a)+w*cos(a);
return h;
}
int main()
{
double right,left,m,mm;
while(cin>>x>>y>>l>>w)
{
left=0;
right=PI/2;
while(right-left>0.0000001)
{
m=(right+left)/2;
mm=(right+m)/2;
if(car(m)>=car(mm)) right=mm;
else left=m;
}
if(car(m)<=y) cout<<"yes"<<endl;
else cout<<"no"<<endl;
}
return 0;
}