Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Codeforces Round 492B
- #include <iomanip>
- #include <iostream>
- using namespace std;
- int main()
- {
- double l, n, k[1001], sub, max=0, top=-1, bot=-1;
- cin >> l >> n;
- for(int i=0;i<l;i++)
- {
- cin >> k[i];
- }
- for(int i=0;i<l;i++)
- {
- for(int y=0;y<l-1;y++)
- {
- if(k[y]>k[y+1])
- {
- sub = k[y];
- k[y] = k[y+1];
- k[y+1] = sub;
- }
- }
- }
- for(int i=0;i<l;i++)
- {
- if(i!=0)
- {
- if((k[i]-k[i-1])>max)
- {
- max = k[i]-k[i-1];
- }
- }
- if(i==l-1)
- {
- top = n - k[i];
- if((top*2)>max){max=top*2;}
- }
- if(i==0)
- {
- bot = k[i];
- if((bot*2)>max){max=bot*2;}
- }
- }
- cout << fixed << setprecision(10) << max/2;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement