codeforces 492B. Vanya and *s 解题报告

时间:2022-03-31 06:28:37

题目链接:http://codeforces.com/problemset/problem/492/B

 #include <cstdio>
 #include <cstdlib>
 #include <iostream>
 #include <algorithm>
 #include <cstring>
 using namespace std;

  + ;
 double a[maxn];
 double l[maxn], r[maxn];

 int main()
 {
     #ifndef ONLINE_JUDGE
         freopen("in.txt", "r", stdin);
     #endif // ONLINE_JUDGE
     int n;
     double ll;
     while (scanf("%d%lf", &n, &ll) != EOF)
     {
         ; i < n; i++)
             scanf("%lf", &a[i]);

         sort(a, a+n);

         memset(l, , sizeof(l));
         memset(r, , sizeof(r));

         l[] = a[];
         r[n-] = ll - a[n-];
         ], r[n-]);

         ; i < n; i++)
         {
             )
                 r[i] = (a[i+] - a[i]) / ;
             else
             {
                 l[i] = (a[i] - a[i-]) / ;
                 r[i] = (a[i+] - a[i]) / ;
             }
             ans = max(max(l[i], r[i]), ans);
         }
         printf("%.10lf\n", ans);
     }
     ;
 }