Description
Vanya walks late at night along a straight street of length l, lit by n *s. Consider the coordinate system with the beginning of the street corresponding to the point 0, and its end corresponding to the point l. Then the i-th * is at the point ai. The * lights all points of the street that are at the distance of at most d from it, where d is some positive number, common for all *s.
Vanya wonders: what is the minimum light radius d should the *s have to light the whole street?
Input
The first line contains two integers n, l (1 ≤ n ≤ 1000, 1 ≤ l ≤ 109) — the number of *s and the length of the street respectively.
The next line contains n integers ai (0 ≤ ai ≤ l). Multiple *s can be located at the same point. The *s may be located at the ends of the street.
Output
Print the minimum light radius d, needed to light the whole street. The answer will be considered correct if its absolute or relative error doesn't exceed 10 - 9.
Sample Input
7 1515 5 3 7 9 14 0
2.5000000000
2 52 5
2.0000000000
Hint
Consider the second sample. At d = 2 the first * will light the segment [0, 4] of the street, and the second * will light segment [3, 5]. Thus, the whole street will be lit.
其实只要 求出最大 间距 再除以2 就是 半径了
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; ]; int n,l; int main(){ while(cin>>n>>l&&n){ ;i<n;i++){ scanf("%lf",x+i); } sort(x,x+n); ; ;i<n;i++){ ma=max(ma,x[i]-x[i-]); } ma/=; ma=max(ma,x[]); ma=max(ma,l-x[n-]); printf("%0.10f",ma); } ; }