![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
二分
文章平均质量分 77
尉水风
这个作者很懒,什么都没留下…
展开
-
C. Really Big Numbers
二分搜索找到最小的符合条件的数据#includeint main(){long long n,s,l,r,mid,ans;scanf("%lld%lld",&n,&s);l=1,r=n,ans=0;while(l{mid=(r-l)/2+l;long long dig,sum;dig=mid;sum=0;while(dig){sum+=d原创 2017-07-16 20:15:12 · 203 阅读 · 0 评论 -
Sagheer and Nubian Market
如果能想到二分求解,这道题目基本就能过了,我说一个坑了我很久的细节吧long long res[maxn],an[maxn];int mid,i;res[i]=an[i]+mid*i;res[i]=an[i]+(long long) (mid*i);res[i]=an[i]+(long long)mid*i;这三种写法看起来很相似,但是当mid*i>int的最大值时,会有不同结果,第一原创 2017-08-20 20:11:42 · 322 阅读 · 0 评论 -
查找
c++stl lower_bound初用问题 C: 查找时间限制: 1 Sec 内存限制: 32 MB提交: 113 解决: 78[提交][状态][TK题库]题目描述输入数组长度 n 输入数组 a[1...n] 输入查找个数m 输入查找数字b[1...m] 输出 YES or NO 查找有则YES 否则NO 。输入原创 2017-10-27 22:12:56 · 194 阅读 · 0 评论 -
Magic Powder - 1
D1. Magic Powder - 1This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution t原创 2018-01-28 15:40:42 · 519 阅读 · 0 评论 -
Magic Powder - 2
D2. Magic Powder - 2The term of this problem is the same as the previous one, the only exception — increased restrictions.InputThe first line contains two positive integers n原创 2018-01-28 16:30:56 · 161 阅读 · 0 评论 -
Number of Ways
You've got array a[1], a[2], ..., a[n], consisting of n integers. Count the number of ways to split all the elements of the array into three contiguous parts so that the sum of elements in each part i...原创 2018-02-22 17:28:35 · 351 阅读 · 0 评论 -
优化延迟
小Ho编写了一个处理数据包的程序。程序的输入是一个包含N个数据包的序列。每个数据包根据其重要程度不同,具有不同的"延迟惩罚值"。序列中的第i个数据包的"延迟惩罚值"是Pi。如果N个数据包按照<Pi1, Pi2, ... PiN>的顺序被处理,那么总延迟惩罚SP=1*Pi1+2*Pi2+3*Pi3+...+N*PiN(其中i1, i2, ... iN是1, 2, 3, ... N的一个排...原创 2018-03-03 20:22:11 · 232 阅读 · 0 评论 -
River Hopscotch
River Hopscotch Every year thecows hold an event featuring a peculiar version of hopscotch that involvescarefully jumping from rock to rock in a river. The excitement takes place on along, straight ri...原创 2018-05-12 22:42:25 · 243 阅读 · 0 评论