Codeforces Round #280 (Div. 2) B

导出库的版本_Windows下PaddleOCR在C++中的推理部署(CPU版本)CMake + VS2017 PaddleOCR是一个与OCR相关的开源项目,不仅支持超轻量级中文OCR预测模型,总模型仅8.6M(单模型支持中英文数字组合识别、竖排文本识别、长文本识别,其中检测模型DB(4.1M)+识别模型CRNN(4.5M)),而且提供多种文本检测训练算法(EAST、DB)和多种文本识别训练算法(Rosetta、CRNN、STAR-Net、RARE)。本文将教大家通过PaddleOCR(CPU版... 阅读详情

题目:

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

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 n, l (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 test(s)
input
7 15
15 5 3 7 9 14 0
output
2.5000000000
input
2 5
2 5
output
2.0000000000
Note

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.


分析:一个长l的街道,在一些指定点上会有一些灯笼,问灯笼最小照亮半径为多少可以照亮整条街。

处理下,相邻元素最大值,注意一下0 or L处没有灯笼的情况。

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <cassert>
#include <algorithm>
#include <cmath>
#include <set>
#include <limits>
#include <map>

using namespace std;

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define F(i, n) for(int (i)=0;(i)<(n);++(i))
#define REP(i, s, t) for(int (i)=(s);(i)<=(t);++(i))
#define UREP(i, s, t) for(int (i)=(s);(i)>=(t);--(i))
#define REPOK(i, s, t, o) for(int (i)=(s);(i)<=(t) && (o);++(i))
#define MEM0(addr) memset((addr), 0, sizeof((addr)))

#define PI 3.1415926535897932384626433832795
#define HALF_PI 1.5707963267948966192313216916398

#define MAXN 100000
#define MAXM 10000
#define MOD 1000000007

typedef long long LL;

const double maxdouble = numeric_limits<double>::max();
const double eps = 1e-10;
const int INF = 0x7FFFFFFF;



int a[1005];
int main()
{
    int n,l;
    while(cin>>n>>l)
    {
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
        }
        sort(a,a+n);
        int ma = -1;
        for(int i=1;i<n;i++)
        {
            int tmp = a[i] - a[i-1];
            ma = max(tmp,ma);
        }
        int x = 2*(a[0] - 0);
        int y = 2*(l - a[n-1]);
        ma = max(ma,x);
        ma = max(ma,y);
        double ans = (double) ma/2;
        printf("%.10lf\n",ans);
    }
}




simulink可控励磁同步电机模型分析 他励同步电机模型分析 阅读详情

相关推荐

CASIA数据集解析:图像篡改检测的黄金标准与实践指南

本文深入解析了CASIA数据集在图像篡改检测领域的核心价值与应用实践。作为中科院自动化所打造的黄金标准,CASIA数据集通过模拟真实篡改场景(如拼接和复制移动)为研究者提供全面支持。文章详细对比了v1.0与v2.0版本差异,分享数据预处理和模型训练的最佳实践,并探讨了未来研究方向,是图像篡改检测领域的重要参考指南。

kappa的博客 784

Codeforces Round #280 (Div. 2) 解题报告 A.B.C.D.E.

不知道到底是我的水平提高了还是CF的题目变水了。。。。。。 A - Vanya and Cubes 水题。。暴力枚举就可以。。 代码如下: #include #include #include #include #include #include #include #include #include #include #include using namespa

scf0920 1160

微信小程序 实现拼图功能

微信小程序 实现碎片拼图

weixin_45689786的博客 2250

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

A - Vanya and Cubes: #include #include #include using namespace std; typedef __int64 ll; const int N = 10005; ll a[N]; int main() { a[0] = 0; for( ll i = 1; i <= 10000; i++ ) {

uuuuuu 515

MMSegmentation 安装教程,避免mmcv不合适版本,及相关问题解决

都行,不做要求。

qq_43683133的博客 1219

VisionMaster Qt二次开发:图像获取、COM组件渲染与本地化存储实战

本文详细介绍了基于VisionMaster进行Qt二次开发的核心实战流程,涵盖环境搭建、方案加载、图像数据获取、COM组件渲染与本地化存储。重点解析了如何通过COM组件在Qt界面中实时显示图像,以及将VM图像数据转换为QImage并保存为本地文件的关键步骤与常见问题,为工业视觉项目开发提供稳定高效的解决方案。

weixin_29229261的博客 205

Codeforces Round #280 (Div. 2) b

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34235135的博客 105

从零搭建Obsidian智能知识库:Ollama本地模型与Copilot插件实战指南

本文详细介绍了如何从零搭建Obsidian智能知识库,结合Ollama本地模型与Copilot插件实现高效知识管理。通过本地部署AI助手,用户可以在保证隐私安全的同时,快速检索和整理笔记,提升工作效率。文章涵盖硬件准备、Ollama部署、插件配置及实战技巧,适合需要高效知识管理的专业人士。

weixin_29230773的博客 631

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

http://codeforces.com/contest/492 A 水题 A. Vanya and Cubes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output

mfcheer 635

VTK-9.5.0 1D2D3DWidget实现灰度图+深度图+3D点云显示(可轻松集成到自己的项目)

VTK1D2D3DWidget是一个基于Qt和VTK开发的3D点云可视化工具,支持RGB和深度点云数据的显示与处理。主要功能包括点云加载、可视化、保存为PLY格式文件,以及背景颜色、点间隔、坐标轴显示等参数的自定义设置。该工具采用模块化设计,核心组件包括主窗口管理类、VTK渲染组件和自定义鼠标交互样式,依赖Qt5+和VTK9.5.0库实现跨平台支持。项目提供完整的源码和构建指南,适用于点云数据的快速展示与分析。

Qt历险记,专注Qt技术,三年医疗设备研发经验,1年机器视觉研发经验,半年柔性传感研发经验。 385

OData Request:Create Entity 在 ABAP OData Client Proxy 中的工程化实践

文章摘要 本文针对具备 SAP Gateway 与 ABAP 开发经验的读者,详细讲解如何通过 ABAP OData Client Proxy 实现 OData 服务的 Create 操作。首先对比了 OData V2 与 V4 的 Create 规范差异,强调键、集合 URL 和请求体的标准化要求。随后介绍了 ABAP Client Proxy 的编程模型,包括 Client Proxy、Entity List Resource 和 Create Request/Response 三个核心对象,并提供了完

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 247

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

A. Vanya and Cubes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vanya got n cubes. He decided to build a pyramid fr

mystery_guest的博客 560

乐企归集能力说明文档V2.0006

纳税人销售货物、提供服务开具的增值税发票及购进货物、接受服务取得的增值税发票、海关缴款书(含出口转内销证明)、代扣代缴完税凭证,可以通过本能力进行归集。纳税人可将本能力中的各类规则和接口嵌入本单位信息化系统中(如:销售、报销、财务等),实现发票自动化归集,便于纳税人完成发票入账、抵扣、退税以及代办退税等操作,有效提升涉税业务办理效率。

记录点滴 573

cf492B--Codeforces Round #280 (Div. 2)B

B. Vanya and Lanternstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVanya walks late at night along a straight street of length l, lit by n lanterns. Consider the coordinate system with the beginning of

qq_62079079的博客 155

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

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

改了时区之后打cf更辛苦了啊。。。昨天没做,今天补了一下啊。 A. Vanya and Cubes 每次加的数规律性很明显就是:(i+1)*i/2。暴力枚举i就可以得到答案。 #include #include #include #include #include #include #include #include #include #include #include

I am a slow walker, but I never walk backwards! 1156

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

Codeforces Round #280 (Div. 2) 解题报告(A B C D E)

A. Vanya and Cubes         思路:累加计算叠到每个高度至少需要多少方块,然后找最后一个满足的即可。 #include #include #include #include #include #include #include #include using namespace std; #define ll long long #define INF 1

A Cube Master 838

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

Vanya and Lanterns( Codeforces Round #280 (Div. 2)B)

此题链接单击这里================题意: 在X轴上半轴有n个小岛,给出每个小岛座标。以X轴为圆心画半径为d的圆,问最少画多少个圆才能把所有的小岛覆盖起来。 思路: 这是一个区间选点问题,先以每个小岛为圆心,d为半径,找到圆与X轴相交的左右端点或相切的点(把圆的方程变换一下,变成求x的方程)。求得的所有的区间进行重合判断。(输入的小岛的纵座标一定大于等于d,否定就直接输出-1)

Folieshell的博客 562

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 input output standard output Vanya gotncubes. He decided to build a pyramid ...

weixin_30478923的博客 95

(Vanya and Lanterns)Codeforces Round #280 (Div. 2)B

此题链接单击这里================= 有问题联系企鹅791267032 邮箱地址….wutanrong@Hotmail.com

Folieshell的博客 534

Codeforces Round #280 (Div. 2)B. Vanya and Lanterns(贪心)

题目链接 题意:告诉你借到的长度是L,然后有m个街灯位置,然后问你街灯的半径R至少多大,才能够使整个街道每个位置都有灯光覆盖。 解答:贪心,先计算最大的2个街灯之间的距离,然后再看下端点处 #define CF #ifndef CF #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> #include<st

qwesde 324

Codeforces #280 (Div.2 A~E)

Codeforces Round #280 (Div. 2) A. Vanya and Cubes 题意: Vanya要堆金字塔,第1层要1个方块,第2层要1+2个,第3层要1+2+3个,以此类推。现在Vanya有n个方块,求能堆的金字塔的最大高度。 题解: 设金字塔高度为h,则需要的积木数为\sum_{i = 1} ^ {h} {\sum_{j = 1} ^ {i} {j}

skywalkert's space 1251

Codeforces Round #280 (Div. 2) a

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34396103的博客 84

【codeforces】Codeforces Round #280 (Div. 2) 水题专场

传送门:【codeforces】Codeforces Round #280 (Div. 2) 492A. Vanya and Cubes 找到最大的i使得1+2+3+……+i小于等于n,并且输出i。 #include #include #include using namespace std ; typedef long long LL ; #define rep( i ,

poursoul 793

Codeforces Round #280 (Div. 2) c

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34247299的博客 109

Codeforces Round #280 (Div. 2)

A. Vanya and Cubes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vanya got n cubes. He decided to build a pyramid

一点也不二 1061

Codeforces Round #280 (Div. 2) d

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34061042的博客 81
上一篇: Codeforces Round #280 (Div. 2) A
下一篇: Codeforces Round #280 (Div. 2) C
Notdeep__acm
博客等级 码龄12年 20粉丝 53原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值