CF248C.Robo-Footballer

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

It's a beautiful April day and Wallace is playing football with his friends. But his friends do not know that Wallace actually stayed home with Gromit and sent them his robotic self instead. Robo-Wallace has several advantages over the other guys. For example, he can hit the ball directly to the specified point. And yet, the notion of a giveaway is foreign to him. The combination of these features makes the Robo-Wallace the perfect footballer — as soon as the ball gets to him, he can just aim and hit the goal. He followed this tactics in the first half of the match, but he hit the goal rarely. The opposing team has a very good goalkeeper who catches most of the balls that fly directly into the goal. But Robo-Wallace is a quick thinker, he realized that he can cheat the goalkeeper. After all, they are playing in a football box with solid walls. Robo-Wallace can kick the ball to the other side, then the goalkeeper will not try to catch the ball. Then, if the ball bounces off the wall and flies into the goal, the goal will at last be scored.

Your task is to help Robo-Wallace to detect a spot on the wall of the football box, to which the robot should kick the ball, so that the ball bounces once and only once off this wall and goes straight to the goal. In the first half of the match Robo-Wallace got a ball in the head and was severely hit. As a result, some of the schemes have been damaged. Because of the damage, Robo-Wallace can only aim to his right wall (Robo-Wallace is standing with his face to the opposing team's goal).

The football box is rectangular. Let's introduce a two-dimensional coordinate system so that point ( 00 , 00 ) lies in the lower left corner of the field, if you look at the box above. Robo-Wallace is playing for the team, whose goal is to the right. It is an improvised football field, so the gate of Robo-Wallace's rivals may be not in the middle of the left wall.

In the given coordinate system you are given:

  • y1y_{1} , y2y_{2} — the yy -coordinates of the side pillars of the goalposts of robo-Wallace's opponents;
  • ywy_{w} — the yy -coordinate of the wall to which Robo-Wallace is aiming;
  • xbx_{b} , yby_{b} — the coordinates of the ball's position when it is hit;
  • rr — the radius of the ball.

A goal is scored when the center of the ball crosses the OYOY axis in the given coordinate system between ( 00 , y1y_{1} ) and ( 00 , y2y_{2} ). The ball moves along a straight line. The ball's hit on the wall is perfectly elastic (the ball does not shrink from the hit), the angle of incidence equals the angle of reflection. If the ball bounces off the wall not to the goal, that is, if it hits the other wall or the goal post, then the opposing team catches the ball and Robo-Wallace starts looking for miscalculation and gets dysfunctional. Such an outcome, if possible, should be avoided. We assume that the ball touches an object, if the distance from the center of the ball to the object is no greater than the ball radius rr .

输入格式

The first and the single line contains integers y1y_{1} , y2y_{2} , ywy_{w} , xbx_{b} , yby_{b} , rr ( 1<=y1,y2,yw,xb,yb<=1061<=y_{1},y_{2},y_{w},x_{b},y_{b}<=10^{6} ; y_{1}<y_{2}<y_{w} ; y_{b}+r<y_{w} ; 2·r<y_{2}-y_{1} ).

It is guaranteed that the ball is positioned correctly in the field, doesn't cross any wall, doesn't touch the wall that Robo-Wallace is aiming at. The goal posts can't be located in the field corners.

输出格式

If Robo-Wallace can't score a goal in the described manner, print "-1" (without the quotes). Otherwise, print a single number xwx_{w} — the abscissa of his point of aiming.

If there are multiple points of aiming, print the abscissa of any of them. When checking the correctness of the answer, all comparisons are made with the permissible absolute error, equal to 10810^{-8} .

It is recommended to print as many characters after the decimal point as possible.

输入输出样例

  • 输入#1

    4 10 13 10 3 1
    

    输出#1

    4.3750000000
    
  • 输入#2

    1 4 6 2 2 1
    

    输出#2

    -1
    
  • 输入#3

    3 10 15 17 9 2
    

    输出#3

    11.3333333333
    

说明/提示

Note that in the first and third samples other correct values of abscissa xwx_{w} are also possible.

首页