poj 2566 Bound Found(尺取法 好题)
2015-08-28 02:46
405 查看
DescriptionSignalsofmostprobablyextra-terrestrialoriginhavebeenreceivedanddigitalizedbyTheAeronauticandSpaceAdministration(thatmustbegoingthroughadefiantphase:"ButIwanttousefeet,notmeters!").Eachsignalseemstocomeintwoparts:asequenceofnintegervaluesandanon-negativeintegert.We'llnotgointodetails,butresearchersfoundoutthatasignalencodestwointegervalues.Thesecanbefoundasthelowerandupperboundofasubrangeofthesequencewhoseabsolutevalueofitssumisclosesttot. Youaregiventhesequenceofnintegersandthenon-negativetargett.Youaretofindanon-emptyrangeofthesequence(i.e.acontinuoussubsequence)andoutputitslowerindexlanditsupperindexu.Theabsolutevalueofthesumofthevaluesofthesequencefromthel-thtotheu-thelement(inclusive)mustbeatleastasclosetotastheabsolutevalueofthesumofanyothernon-emptyrange. Input Output SampleInput SampleOutput 528 911 15115 15115 Source 尺取法,注意inf初始化 #include<iostream> ViewCode |
相关文章推荐
- WingIDE破解 python2.x和python3.x
- IIS7.5安全配置研究
- Oracle 权限 管理大全
- ubuntu git 服务器搭建
- 升级WIN10后80端口被占用
- oracle登陆账户信息
- oracle登陆命令
- JS 的 call apply bind 方法
- Pow(x, n)
- 可以替代Ghost的系统备份/恢复利器Clonezilla
- LightOJ 1072 - Calm Down 【二分】
- python数据结构与算法——哈希表
- Product of Array Except Self
- union和union all的区别
- maven 如何修改仓库repository 位置
- 8行代码教你搞定导航控制器全屏滑动返回效果
- HTML标签深入学习系列(1)——注释标签 <!-- -->
- hdu 4630 No Pain No Game (区间gcd相关x线段树or树状数组)
- 软件包管理 rpm yum apt-get dpkg
- 生物网络医学:帝王之镜