Vanya and Lanterns
来源:互联网 发布:ubuntu 安装php7 编辑:程序博客网 时间:2024/05/24 05:10
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
#define MAXN 1111
double num[MAXN];
int main()
{
int n;
double l;
while(scanf("%d %lf",&n, &l) != EOF)
{
double maxn = 0;
for( int i = 0; i < n; i++)
scanf("%lf",&num[i]);
sort(num, num + n);
maxn = num[0];
for( int i = 1; i < n; i++)
maxn = max(maxn,(num[i] - num[i-1])/2.0);
maxn = max(maxn, l - num[n-1]);
printf("%.10lf\n",maxn);
}
}
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
#define MAXN 1111
double num[MAXN];
int main()
{
int n;
double l;
while(scanf("%d %lf",&n, &l) != EOF)
{
double maxn = 0;
for( int i = 0; i < n; i++)
scanf("%lf",&num[i]);
sort(num, num + n);
maxn = num[0];
for( int i = 1; i < n; i++)
maxn = max(maxn,(num[i] - num[i-1])/2.0);
maxn = max(maxn, l - num[n-1]);
printf("%.10lf\n",maxn);
}
}
0 0
- Vanya and Lanterns
- B. Vanya and Lanterns
- B - Vanya and Lanterns
- B - Vanya and Lanterns
- Vanya and Lanterns
- CF_492B Vanya and Lanterns
- codeforces Vanya and Lanterns
- Codeforces Vanya and Lanterns
- 492B - Vanya and Lanterns
- codeforce492 B. Vanya and Lanterns
- Codefroces 280 div2 B. Vanya and Lanterns
- Codeforces 492B. Vanya and Lanterns 二分
- Codeforces 492B Vanya and Lanterns(水)
- coderforce 492B Vanya and Lanterns
- CF 280B. Vanya and Lanterns(div2)
- Codeforces-492B-Vanya and Lanterns
- Codeforces 492B Vanya and Lanterns【贪心】
- Codeforces Round 280 Div2 B Vanya and Lanterns(binary serch)
- 从零开始----以后所以文章都发布在这里
- 如何在Eclipse中显示空格(space)和制表符(tab)
- ARM S3C2410 datasheet 重点解读
- 递归与尾递归(C语言)
- s3c2410的缓存及写Buffer讲解
- Vanya and Lanterns
- 多态性C#
- POJ 2186 Popular Cows
- Optimal Binary Search Tree
- java一些不得不知道的概念
- 编译原理经典书
- java成长必备书籍
- java 接口的简单程序
- java文件综合训练