您的位置:首页 > 产品设计 > UI/UE

cf590B Chip 'n Dale Rescue Rangers

2015-11-01 00:19 405 查看
B. Chip 'n Dale Rescue Rangers

time limit per test
1 second

memory limit per test
256 megabytes

input
standard input

output
standard output

A team of furry rescue rangers was sitting idle in their hollow tree when suddenly they received a signal of distress. In a few moments they were ready, and the dirigible of the rescue chipmunks hit the road.

We assume that the action takes place on a Cartesian plane. The headquarters of the rescuers is located at point (x1, y1), and the distress signal came from the point (x2, y2).

Due to Gadget's engineering talent, the rescuers' dirigible can instantly change its current velocity and direction of movement at any moment and as many times as needed. The only limitation is: the speed of the aircraft relative to the air can not exceed

#include<set>
#include<map>
#include<ctime>
#include<deque>
#include<queue>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
#define inf 0x7fffffff
#define pa pair<int,int>
#define pi 3.1415926535897932384626433832795028841971
#define eps 1e-8
using namespace std;
inline LL read()
{
LL x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
double x1,x2,y1,y2,x,y,l,r,ans,vm,t,sumx,sumy;
int tot;
inline bool jud(double mid)
{
sumx=x;sumy=y;
if (mid<=t)sumx-=mid*x1,sumy-=mid*y1;
else sumx-=t*x1+(mid-t)*x2,sumy-=t*y1+(mid-t)*y2;
return mid*mid*vm*vm>=sumx*sumx+sumy*sumy;
}
int main()
{
scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);x=x2-x1;y=y2-y1;
scanf("%lf%lf",&vm,&t);
scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
tot--;
l=0;r=100000000;
while (l+eps<r)
{
double mid=(l+r)/2;
if(jud(mid)){ans=mid;r=mid;}
else l=mid;
}
printf("%.7lf\n",ans);
return 0;
}


cf590B
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: