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  meters per second.

Of course, Gadget is a true rescuer and wants to reach the destination as soon as possible. The matter is complicated by the fact that the wind is blowing in the air and it affects the movement of the dirigible. According to the weather forecast, the wind will be defined by the vector (vx, vy) for the nearest t seconds, and then will change to (wx, wy). These vectors give both the direction and velocity of the wind. Formally, if a dirigible is located at the point (x, y), while its own velocity relative to the air is equal to zero and the wind (ux, uy) is blowing, then after  seconds the new position of the dirigible will be .

Gadget is busy piloting the aircraft, so she asked Chip to calculate how long will it take them to reach the destination if they fly optimally. He coped with the task easily, but Dale is convinced that Chip has given the random value, aiming only not to lose the face in front of Gadget. Dale has asked you to find the right answer.

It is guaranteed that the speed of the wind at any moment of time is strictly less than the maximum possible speed of the airship relative to the air.

Input

The first line of the input contains four integers x1, y1, x2, y2 (|x1|,  |y1|,  |x2|,  |y2| ≤ 10 000) — the coordinates of the rescuers' headquarters and the point, where signal of the distress came from, respectively.

The second line contains two integers  and t (0 < v, t ≤ 1000), which are denoting the maximum speed of the chipmunk dirigible relative to the air and the moment of time when the wind changes according to the weather forecast, respectively.

Next follow one per line two pairs of integer (vx, vy) and (wx, wy), describing the wind for the first t seconds and the wind that will blow at all the remaining time, respectively. It is guaranteed that  and .

Output

Print a single real value — the minimum time the rescuers need to get to point (x2, y2). You answer will be considered correct if its absolute or relative error does not exceed 10 - 6.

Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .

Sample test(s)
input
0 0 5 5
3 2
-1 -1
-1 0
output
3.729935587093555327
input
0 0 0 1000
100 1000
-50 0
50 0
output
11.547005383792516398

如果学过一点物理,你就会知道运动具有独立性,那么飞艇的运动可以拆成驱动运动和风力运动
二分一个答案,很容易判断解是否可行
 #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=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';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=;r=;
while (l+eps<r)
{
double mid=(l+r)/;
if(jud(mid)){ans=mid;r=mid;}
else l=mid;
}
printf("%.7lf\n",ans);
return ;
}

cf590B

cf590B Chip 'n Dale Rescue Rangers的更多相关文章

  1. codeforces 590B B. Chip 'n Dale Rescue Rangers(二分+计算几何)

    题目链接: B. Chip 'n Dale Rescue Rangers time limit per test 1 second memory limit per test 256 megabyte ...

  2. Codeforces Round #327 (Div. 1) B. Chip 'n Dale Rescue Rangers 二分

    题目链接: 题目 B. Chip 'n Dale Rescue Rangers time limit per test:1 second memory limit per test:256 megab ...

  3. Codeforces Round #327 (Div. 2) D. Chip 'n Dale Rescue Rangers 二分 物理

    D. Chip 'n Dale Rescue Rangers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/co ...

  4. CodeForces 590B Chip 'n Dale Rescue Rangers

    这题可以o(1)推出公式,也可以二分答案+验证. #include<iostream> #include<cstring> #include<cmath> #inc ...

  5. codeforces590b//Chip 'n Dale Rescue Rangers//Codeforces Round #327 (Div. 1)

    题意:从一点到另一点,前t秒的风向与t秒后风向不同,问到另一点的最短时间 挺难的,做不出来,又参考了别人的代码.先得到终点指向起点的向量,设T秒钟能到.如果T>t则受风1作用t秒,风2作用T-t ...

  6. Codeforces Round #327 590B Chip 'n Dale Rescue Rangers(等效转换,二分)

    t和可到达具有单调性,二分就不多说了.下面说下O(1)的做法,实际上是等效转换,因为答案一定存在,如果在t0之前,那么分解一下 直接按照只有v计算就可以了.反过来如果计算的结果大于t0,那么表示答案在 ...

  7. (Gym 100685G) Gadget Hackwrench(LCA在线ST)

    Gadget Hackwrench time limit per test 2 seconds memory limit per test 64 megabytes input standard in ...

  8. FC红白机游戏列表(维基百科)

    1055个fc游戏列表 日文名 中文译名 英文版名 发行日期 发行商 ドンキーコング 大金刚 Donkey Kong 1983年7月15日 任天堂 ドンキーコングJR. 大金刚Jr. Donkey K ...

  9. openjudge 螺旋加密

    /*======================================================================== 25:螺旋加密 总时间限制: 1000ms 内存限 ...

随机推荐

  1. PHP: 深入pack/unpack <转> [链接]

    PHP: 深入pack/unpack PHP: chr和pack.unpack那些 PHP: pack/unpack补遗

  2. python小练习,打出1-100之间的所有偶数,设计一个函数,在桌面上创建10个文件,并以数字命名,复利计算函数

    练习一:打出1-100之间的所有偶数 def even_print(): for i in range(1,101): if i % 2 == 0: print (i) even_print() #列 ...

  3. HUD3336

    /* 巧妙地使用fail数组 根据fail数组的定义 fail[i] 有 长度为i的子串最长公共前后缀为fail[i] 比如样例 fail 0 0 1 2 那么我们维护一个ans[i]表示到i位置的时 ...

  4. tomcat发布去掉项目的名称

    1.找到tomcat的文件夹,打开conf目录的server.xml,我的是Linux系统所以用vi server.xml,总之打开就行 2.找到如下语句 加入下面箭头的路径,docBase为项目所在 ...

  5. ADO.NET和ORACLE操作数据库传参数赋值的方式

    在使用.Net使用OracleParameter进行Oracle数据库操作的时候,因为Oracle和SQLServer针对查询参数化的语法不同, 在操作SQLServer的时候使用的是@Paramet ...

  6. HTML DOM节点

    在 DOM 树中,基本上一切都是节点.每个元素在最底层上都是 DOM 树中的节点.每个属性都是节点.每段文本都是节点.甚至注释.特殊字符(如版权符号 ©).DOCTYPE 声明(如果 HTML 或者 ...

  7. asp.net微信开发第四篇----已关注用户管理

    公众号可通过本接口来获取帐号的关注者列表,关注者列表由一串OpenID(加密后的微信号,每个用户对每个公众号的OpenID是唯一的)组成.一次拉取调用最多拉取10000个关注者的OpenID,可以通过 ...

  8. Cacti以MB为单位监控流量

    Cacti自带的流量监控阀值模板为“Interface – Traffic”,只能监控bytes,在添加阀值之后,报警的流量信息以bytes为单位,查看很不友好,可以通过以下方法将btyes转换成MB ...

  9. 加入强调语气,使用<strong>和<em>标签

    有了段落又有了标题,现在如果想在一段话中特别强调某几个文字,这时候就可以用到<em>或<strong>标签. 但两者在强调的语气上有区别:<em> 表示强调,< ...

  10. [个人原创]关于java中对象排序的一些探讨(三)

    这篇文章由十八子将原创,转载请注明,并标明博客地址:http://www.cnblogs.com/shibazijiang/ 对对象排序也可以使用Guava中的Ordering类. 构造Orderin ...