Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #include<cstdlib>
- #include<ctime>
- #include <vector>
- #include <algorithm>
- #include <iomanip>
- using namespace std;
- int main()
- {
- int n,l;
- double buff,Max=0,dist;
- vector <double> v;
- cin>>n>>l;
- for (int i=0;i<n;i++)
- {
- cin>>buff;
- v.push_back(buff);
- }
- sort(v.begin(),v.end());
- for (int i=0;i<n-1;i++)
- {
- dist=v[i+1]-v[i];
- if (dist>Max) Max=dist;
- }
- Max=Max/2;
- if (v[0]>Max) {Max=v[0];}
- if (l-v[n-1]>Max) {Max=l-v[n-1];}
- cout<<fixed;
- cout<<setprecision(9)<<Max;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement