아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Pipes

시간 제한0.3초메모리 제한1024 MB

요약
주어진 반지름을 가진 파이프들을 경사진 바닥에서 굴려 벽이나 먼저 굴린 파이프에 멈추게 한 뒤, 가장 먼 지점까지의 거리를 구한다.
난이도

보통10점 중 7점

유형
스택, 기하
정답자
아직 제출이 없습니다

문제

Valter is a fan of experiments. His latest experiment is depicted in the figure: he rolls several pipes down an inclined floor until they are stopped either by the wall perpendicular to the floor or by another pipe rolled earlier; after all the pipes have stopped, Valter measures the distance from the wall to the farthest point of the farthest pipe.

Now his classmate Vanessa pointed out that some pipes may have no impact on the result. For example, in the figure, neither pipe 1 nor pipe 3 impact the positions of the following pipes. In addition, the farthest point may be in a pipe that was not rolled last.

Write a program that gets the radii of the pipes and computes the distance from the wall to the farthest point among all the pipes.

입력

The first line contains NN (1≤N≤1051 \le N \le 10^5), the number of pipes. Each of the following NN lines contains one real number, the radii R_iR\_i (0<R_i≤1090 < R\_i \le 10^9) of the pipes, in the order in which the pipes are rolled. Each radius is given with at most two digits after the decimal point.

출력

Output a single real number: the distance from the wall to the farthest point among all the pipes. The answer xx will be accepted if ∣x−x′∣1+x′<10−6\frac{|x-x'|}{1+x'} < 10^{-6}, where x′x' is the jury's answer.

예제3

  1. 예제 1

    입력
    7
    1
    10
    1
    3
    1
    5
    1
    
    예상 출력
    34.362825
    
  2. 예제 2

    입력
    2
    3324.31
    3324.32
    
    예상 출력
    13297.26
    
  3. 예제 3

    입력
    3
    4.00
    1
    4.0
    
    예상 출력
    16