Description

Vanya walks late at night along a straight street of length l, lit by n lanterns. 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 lantern is at the point ai. The lantern 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 lanterns.

Vanya wonders: what is the minimum light radius d should the lanterns have to light the whole street?

Input

The first line contains two integers nl (1 ≤ n ≤ 1000, 1 ≤ l ≤ 109) — the number of lanterns and the length of the street respectively.

The next line contains n integers ai (0 ≤ ai ≤ l). Multiple lanterns can be located at the same point. The lanterns 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

Input
7 1515 5 3 7 9 14 0
Output
2.5000000000
Input
2 52 5
Output
2.0000000000

Hint

Consider the second sample. At d = 2 the first lantern will light the segment [0, 4] of the street, and the second lantern 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);
    }
 ;
}

Vanya and Lanterns的更多相关文章

  1. cf492B Vanya and Lanterns

    B. Vanya and Lanterns time limit per test 1 second memory limit per test 256 megabytes input standar ...

  2. Codeforces 492B B. Vanya and Lanterns

    Codeforces  492B   B. Vanya and Lanterns 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid= ...

  3. codeforces 492B. Vanya and Lanterns 解题报告

    题目链接:http://codeforces.com/problemset/problem/492/B #include <cstdio> #include <cstdlib> ...

  4. Codeforces Round #280 (Div. 2) A B C 暴力 水 贪心

    A. Vanya and Cubes time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  5. CodeForces Round #280 (Div.2)

    A. Vanya and Cubes 题意: 给你n个小方块,现在要搭一个金字塔,金字塔的第i层需要 个小方块,问这n个方块最多搭几层金字塔. 分析: 根据求和公式,有,按照规律直接加就行,直到超过n ...

  6. Codeforces Round #280 (Div. 2) A , B , C

    A. Vanya and Cubes time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  7. [codeforces] 暑期训练之打卡题(一)

    每个标题都做了题目原网址的超链接 Day1<Vanya and Lanterns> 题意: 一条长度为 l 的街道,在这条街道上放置了n个相同的灯,街道一端位置记为0,每个灯的位置在ai处 ...

  8. Lanterns

    Lanterns 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=86640#problem/B 题目: Description ...

  9. codeforces C. Vanya and Scales

    C. Vanya and Scales Vanya has a scales for weighing loads and weights of masses w0, w1, w2, ..., w10 ...

随机推荐

  1. Python 操作Redis

    redis对比monoDB: redis和memcache 是key value非关系型数据库,mysql是关系型数据库,表的结构和保存的内容有严格的要求,关系型数据库无法保存临时数据或不标准的数据, ...

  2. USACO Party Lamps 【Binary code solvution】【规律】

    写这道题目的时候遇到了一个令人诧异的问题,就是平台上跑来的结果和我本机跑起来的结果不一样. 后来Debug了之后才发现是我数组开小了,只开到100 的数组竟然都去访问他170位的地址肯定要跪成翔啊.. ...

  3. 转:git教程 ~~非常好的入门教程

    --------------------------------------- notes: cdmkdir dirnametouchls > filenamelsecho "this ...

  4. qt5_qml_Opengl_shader 第一弹----------------------openglunderqml的简化及介绍

    最近得知opengl可以通过纹理贴图来渲染yuv的数据,这就免去了yuv-rgb,这个过程在arm上还是很耗时间的,于是就接触了opengl. 写这篇文章的目的是方便初学者使用qml来调用opengl ...

  5. docker学习笔记18:Dockerfile 指令 VOLUME 介绍

    在介绍VOLUME指令之前,我们来看下如下场景需求: 1)容器是基于镜像创建的,最后的容器文件系统包括镜像的只读层+可写层,容器中的进程操作的数据持久化都是保存在容器的可写层上.一旦容器删除后,这些数 ...

  6. cocos2dx进阶学习之CCObject

    继承关系 CCObject -> CCCopying 类定义 class CC_DLL CCObject : public CCCopying { public: // object id, C ...

  7. c-大量经典的c算法---ShinePans

    经典的100个c算法 算法  题目:古典问题:有一对兔子.从出生后第3个月起每一个月都生一对兔子.小兔 子长到第三个月后每一个月又生一对兔子,假如兔子都不死,问每一个月的兔子总数 为多少? _____ ...

  8. SVN的trunk、branch、tag(二)

    转——简单的对比 SVN的工作机制在某种程度上就像一颗正在生长的树: 一颗有树干和许多分支的树 分支从树干生长出来,并且细的分支从相对较粗的树干中长出 一棵树可以只有树干没有分支(但是这种情况不会持续 ...

  9. mysql 表级锁

    表级锁:分为读锁和写锁: lock tables table_name read;//其他事务只能读,不能加写锁,要等待更新. SESSION 50 执行: mysql> update test ...

  10. 浅尝key-value数据库(三)——MongoDB的分布式

    浅尝key-value数据库(三)——MongoDB的分布式 测试了单机MongoDB的随机读和写入性能,这一节来讲一讲MongoDB的分布式. MongoDB的分布式分成两种,一种是Replicat ...