Advertisement
sivan_iut

Untitled

Apr 9th, 2020
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. ///HELLO THERE~!
  2. ///CREATED BY MD SADMAN MEHEDI SIVAN(IUT CSE-SWE^19)
  3.  
  4. #include <bits/stdc++.h>
  5.  
  6. #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  7. #define read freopen("blue.txt","r",stdin);
  8. #define write freopen("red.txt","w",stdout);
  9. #define pie 2*acos(0.0);
  10.  
  11. typedef long long ll;
  12.  
  13. using namespace std;
  14.  
  15. int main()
  16. {
  17.     fastio;
  18.  
  19.     int n,l;
  20.     cin>>n>>l;
  21.  
  22.     int sivan[n+1];
  23.     for(int i=0; i<n; i++)
  24.         cin>>sivan[i];
  25.  
  26.     float f=0;
  27.     float r;
  28.  
  29.     sort(sivan,sivan+n);
  30.  
  31.     float a=(float)sivan[0]-0;
  32.     float b=l-(float)sivan[n-1];
  33.     float bakon=max(a,b);
  34.  
  35.     for(int i=0; i<n-1; i++)
  36.     {
  37.         r=(float)sivan[i+1]-sivan[i];
  38.         if(r>=f)
  39.             f=r;
  40.  
  41.     }
  42.  
  43.     float q=(f/2.0);
  44.  
  45.  
  46.     if(bakon>q)
  47.         cout<<fixed<<setprecision(10)<<bakon;
  48.     else
  49.         cout<<fixed<<setprecision(10)<<q;
  50.  
  51.  
  52.     return 0;
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement