B - B
 

Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u

 

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 15
15 5 3 7 9 14 0
Output
2.5000000000
Input
2 5
2 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.

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;
int n,l;
double s,t,ans,r,u;
int a[];
int main()
{
cin>>n>>l;
double f=;
for(int i=; i<n; i++)
cin>>a[i];
sort(a,a+n);
for(int i=; i<n-; i++)
{
ans=a[i+]-a[i];
if(f<ans)
f=ans;
}
r=f/;
s=a[];
t=(l-a[n-]);
double u=max(s,t);
double v=max(u,r);
printf("%.10lf\n",v);
}

B题(覆盖问题)的更多相关文章

  1. bzoj1052 9.20考试 第二题 覆盖问题

    1052: [HAOI2007]覆盖问题 Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 2004  Solved: 937[Submit][Statu ...

  2. c#面试题汇总

    下面的参考解答只是帮助大家理解,不用背,面试题.笔试题千变万化,不要梦想着把题覆盖了,下面的题是供大家查漏补缺用的,真正的把这些题搞懂了,才能“以不变应万变”.回答问题的时候能联系做过项目的例子是最好 ...

  3. 《Java学习笔记(第8版)》学习指导

    <Java学习笔记(第8版)>学习指导 目录 图书简况 学习指导 第一章 Java平台概论 第二章 从JDK到IDE 第三章 基础语法 第四章 认识对象 第五章 对象封装 第六章 继承与多 ...

  4. .NET工程师面试宝典

    .Net工程师面试笔试宝典 传智播客.Net培训班内部资料 这套面试笔试宝典是传智播客在多年的教学和学生就业指导过程中积累下来的宝贵资料,大部分来自于学员从面试现场带过来的真实笔试面试题,覆盖了主流的 ...

  5. 传智播客DotNet面试题

    技术类面试.笔试题汇总(整理者:杨中科,部分内容从互联网中整理而来) 注:标明*的问题属于选择性掌握的内容,能掌握更好,没掌握也没关系. 下面的参考解答只是帮助大家理解,不用背,面试题.笔试题千变万化 ...

  6. 收藏所用C#技术类面试、笔试题汇总

    技术类面试.笔试题汇总 注:标明*的问题属于选择性掌握的内容,能掌握更好,没掌握也没关系. 下面的参考解答只是帮助大家理解,不用背,面试题.笔试题千变万化,不要梦想着把题覆盖了,下面的题是供大家查漏补 ...

  7. 201621123062《java程序设计》第四周作业总结

    1. 本周学习总结 1.1 写出你认为本周学习中比较重要的知识点关键词 关键词:重载.继承.多态.static.final.抽象类 1.2 尝试使用思维导图将这些关键词组织起来.注:思维导图一般不需要 ...

  8. Week04-面向对象设计与继承

    1. 本周学习总结 1.1 写出你认为本周学习中比较重要的知识点关键词 is a关系 覆盖 Object 超级父类 继承 抽象类 多态 重载 static super private public p ...

  9. 201621123050 《Java程序设计》第4周学习总结

    1. 本周学习总结 1.1 写出你认为本周学习中比较重要的知识点关键词 继承.抽象.多态 1.2 尝试使用思维导图将这些关键词组织起来.注:思维导图一般不需要出现过多的字. 1.3 可选:使用常规方法 ...

  10. 201621123040《Java程序设计》第4周学习总结

    1.本周学习总结 1.1写出你认为本周学习中比较重要的知识点关键词 关键词:继承 多态性 基本语法 重新定义Override 1.2尝试使用思维导图将这些关键词组织起来.注:思维导图一般不需要出现过多 ...

随机推荐

  1. ActionScript接收socket服务器发送来的数据

    原文地址:http://www.asp119.com/news/2009522181815_1.htm 从socket中接收数据的方法取决于你使用socket类型,Socket和XMLSocket都可 ...

  2. Vagrant 集群的部署

    使用Vagrant部署集群 一.运行多个虚拟机 我们通过配置Vagrantfile配置两个虚拟机--web服务器和数据库服务器. Vagrant::configure("2") d ...

  3. Apache HBase 2015年发展回顾与未来展望

    编者按:高可用架构推出 2015 年度回顾系列文章,分享在架构领域具有典型意义的年度案例,本文由张虔熙分享.转载请注明来自高可用架构公众号「ArchNotes」.   张虔熙,Hulu 网,专注于分布 ...

  4. php数组和字符串转换

    PHP 中由于数组和字符串这两种变量类型是如此常用,以至于 PHP 具有两个函数,可以在字符串和数组之间互相进行转换. $array=explode(separator,$string); $stri ...

  5. Unity三种截屏方法(非自带API)

    者利用了三种表现形式: 1,选择截图路径的方法 2,直接截取截屏的方法 3,截取鼠标圈选区域. 上代码,: 第一种是调用.net的类库,需要引用System.Windows.Forms.dll,在As ...

  6. 使用iScroll和photoswipe写手机浏览图片的插件的几点经验

    首先,当我知道我得到一个任务需要写一个在手机上能浏览图片的插件时,我第一想到了iScroll.它的左右滑动,上下滑动的效果在安卓手机上也能让用户有良好的体验,自己写也能方便控制. 我的需求是,插件要能 ...

  7. [Unity3d][NGUI]两种思路解决AssetBundle的依赖关系.

    接上文. 使用上文中的AssetBundle打包方式生成的文件包括了依赖关系中的文件. 一般的使用中并不会发现什么问题. 可是当配合NGUI的时候,使用dynamicFont时打包AssetBundl ...

  8. poj2239 Selecting Courses --- 二分图最大匹配

    匈牙利算法模板题 有n门课程,每门课程可能有不同一时候间,不同一时候间的课程等价. 问不冲突的情况下最多能选多少门课. 建立二分图,一边顶点表示不同课程,还有一边表示课程的时间(hash一下). #i ...

  9. JDK5-枚举

    1. 使用普通类模拟枚举 public class Weekday { private Weekday() {} // 私有化 public static final Weekday MONDAY = ...

  10. 二分图最大匹配(匈牙利算法Dfs模板)

    #include<iostream> #include<cstdio> #include<cstring> #define maxn 2020 using name ...