Pipes | 프로그래밍의 벗 PivotOJ
PivotOJ

Pipes

시간 제한: 300ms메모리 제한: 1024MB출처: EIO 2022-23 sel2BOJ 29845
이 문제는 본문 이미지 일부가 표시되지 않습니다. 텍스트만으로 풀이가 어려울 수 있습니다.

문제

[이미지 1]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 (1N1051 \le N \le 10^5), the number of pipes. Each of the following NN lines contains one real number, the radii RiR_i (0<Ri1090 < 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 xx1+x<106\frac{|x-x'|}{1+x'} < 10^{-6}, where xx' is the jury's answer.

예제

예제 1

입력
7
1
10
1
3
1
5
1
출력
34.362825

예제 2

입력
2
3324.31
3324.32
출력
13297.26

예제 3

입력
3
4.00
1
4.0
출력
16
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.