2014
03-16

# Hot girl with cool car

Huahua is a beautiful girl. Since she is still single, you can imagine how many boys want to dating with her on Saint Valentine’s Day! Huahua is a clever girl, she do know well how to pick a boy by the way she like.

Unlike other girls, Huahua have a special hobby, that she is a professional fan of automobile race game. Her interest ranging widely from real car racing such as Formula 1, Dakar Rally, Le Mans World Endurance Championship, even to virtual games ,for instance, Need for Speed. Just because of this, Huahua is extremely popular in boys’ eyes. It is a universally truth that hot girl with powerful cool car, everybody becomes blood surge!

Now Huahua got an idea. You know in professional racing game, choose a most suitable path when steer is very important. It can even decide the result. Driver must know very well about the road condition, control car speed at the braking point before entering curve, and turn wheel immediately at the beginning of the curve. But when is the right time to turn? Which is the best path? Huahua rise this technical problem to you.

Suppose there is a racing track shown in Graph 1, and we are facing a regular curve. Huahua will tell you the road condition: w (Unit: Meter) stands for the track wide, r (Unit: Meter) for the turning radius (inside the track), and θ ( 0°< θ <=180°) for the the angle of the curve we discussing. Since larger turning radius can provide driver better control experience and gain more time, your task is to tell Huahua the largest turning radius driver can pick. The one who first slove this problem will become the lucky dog and able to dating with Huahua on Saint Valentine’s Day!

Graph 1: Racing Track

There are multiple cases, please process to End of File.
For each case:
Three postive real number: r, w, θ, as described above.

There are multiple cases, please process to End of File.
For each case:
Three postive real number: r, w, θ, as described above.

30 70 90

268.995

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<sstream>
#include<map>
#include<set>
#include<cmath>
#include<iomanip>
#include<cstdlib>
#include<cctype>
#include<assert.h>
#include<stack>
#include<queue>
#include<vector>
#include<list>
using namespace std;
double pi=acos(-1);
double w,r,sita;
int main() {
while(~scanf("%lf%lf%lf",&r,&w,&sita))
{
sita/=180.;
sita*=pi;
double umc=cos(sita/2.)-1.;
r-=w/umc;
printf("%.3f\n",r);
}
return 0;
}

1. int half(int *array,int len,int key)
{
int l=0,r=len;
while(l<r)
{
int m=(l+r)>>1;
if(key>array )l=m+1;
else if(key<array )r=m;
else return m;
}
return -1;
}
这种就能避免一些Bug
l,m,r
左边是l,m;右边就是m+1,r;

2. 这道题目的核心一句话是：取还是不取。
如果当前取，则index+1作为参数。如果当前不取，则任用index作为参数。

3. 思路二可以用一个长度为k的队列来实现，入队后判断下队尾元素的next指针是否为空，若为空，则出队指针即为所求。