2014
01-26

# 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.

Every line has four real numbers, x, y, l and w.
Proceed to the end of file.

10 6 13.5 4
10 6 14.5 4

yes
no

#include<iostream>
#include<cmath>
using namespace std;
const double Pi = acos(-1.0), eps = 1e-6;
double x, y, l, w;

double fun(double a)
{
return -((x - l*sin(a) - w/cos(a))/tan(a));
}

double find(double l, double r)
{
double mid, midmid;
while(r-l > eps)
{
mid = (l+r)/2;
midmid = (r+mid)/2;
if(fun(mid) > fun(midmid))
r = midmid;
else l = mid;
}
return l;
}

int main()
{
while(cin>>x>>y>>l>>w)
{
if(x < w || y < w || fun(find(0, Pi/2)) > y) cout<<"no"<<endl;
else cout<<"yes"<<endl;

}
return 0;
}

1. 大家看问题不够透彻啊。其实进口税高也不完全是坏事。当然个人也觉得国外东西的确也是有一部分相当不错的，也有不如国产的。毕竟进口进来还是有一定优势才会进口，不然赚不了钱进口不是会亏损？

2. #include <stdio.h>
int main(void)
{
int arr[] = {10,20,30,40,50,60};
int *p=arr;
printf("%d,%d,",*p++,*++p);
printf("%d,%d,%d",*p,*p++,*++p);
return 0;
}

为什么是 20,20,50,40,50. 我觉得的应该是 20,20,40,40,50 . 谁能解释下？