// ConsoleApplication3.cpp : 定义控制台应用程序的入口点。

//

#include "stdafx.h"
#include<iostream>
#include<vector>
#include<deque>
#include<iomanip>
#include<algorithm>
using namespace std; int main()
{
int n;
long int l;
while (cin >> n >> l)
{
vector<long int> lamps;
for (int i = 0; i < n; i++)
{
long int t;
cin >> t;
lamps.push_back(t);
}
//排序
for (int i = 0; i < n; i++)
{
for (int j = i + 1; j < n; j++)
{
if (lamps[i] > lamps[j])
{
long temp = lamps[j];
lamps[j] = lamps[i];
lamps[i] = temp;
}
}
} double max = lamps[1] - lamps[0];
for (int i = 1; i < n - 1; i++) //找到间间距最大的
{
if (lamps[i + 1] - lamps[i]>max)
{
max = lamps[i + 1] - lamps[i];
}
}
max = max / 2; if (l - lamps[n - 1] > max)
{
max = l - lamps[n - 1];
}
if (lamps[0] > max)
{
max = lamps[0];
} cout << setiosflags(ios::fixed);
cout << setprecision(2) << max << endl; } return 0;
}

最新文章

  1. Kafka0.8.2.1删除topic逻辑
  2. HTML5学习
  3. 【HTML】Iframe中的onload事件
  4. C# Dictionary和Dynamic类型
  5. JavaScript的循环语句
  6. POSTMAN中各种请求方式的区别
  7. 【原】简述使用spark集群模式运行程序
  8. [Windows]VS2010如何以管理员权限启动?(转)
  9. ios调打电话代码
  10. 解决ubuntu合盖后无法唤醒
  11. 简约的返回顶部效果(jQuery)
  12. Android菜鸟的成长笔记(28)——Google官方对Andoird 2.x提供的ActionBar支持
  13. querySelector和querySelectorAll方法介绍
  14. 利用git下载skia库
  15. jpgraph 折线图--解决中文乱码的问题(标题和图例)
  16. jQuery中的prop()和attr()的区别
  17. scala调用Linux命令行
  18. JMeter http(s)请求插件jmeter-plugin-httpBinaryFileUpload.jar
  19. Kafka消费时报错:Producer connection to xxx:9092 unsuccessful
  20. Digispark红外接收器

热门文章

  1. 洛谷P2114起床困难综合征
  2. UVa 11234 The Largest Clique
  3. [LeetCode] Maximum Depth of Binary Tree dfs,深度搜索
  4. android基本控件学习-----SeekBar&amp;RatingBar
  5. 例说linux内核与应用数据通信系列【转】
  6. 查询/删除/建立DB2数据表的主键
  7. Codeforces Gym101473 A.Zero or One (2013-2014 ACM-ICPC Brazil Subregional Programming Contest)
  8. 块级元素和行内元素的区别 (block vs. inline)
  9. 一个项目多个App项目搭建
  10. EasyMvc入门教程-基本控件说明(3)时间线