尺取&二分&三分
creator平
期望破茧成蝶时的飞翔,向往突破蝉蛹后的鸣叫。
展开
-
POJ - 3104
It is very hard to wash and especially to dry clothes in winter. But Jane is a very smart girl. She is not afraid of this boring process. Jane has decided to use a radiator to make drying faster. But ...原创 2018-04-02 20:16:48 · 193 阅读 · 0 评论 -
UVALive - 2678 Subsequence (尺取)
题目链接:https://cn.vjudge.net/problem/UVALive-2678题意:找出区间的和大于等于S的最短区间思路:尺取法#include<algorithm>#include<string.h>#include<stdio.h>using namespace std;int A[100010];int main()...原创 2019-05-10 21:39:47 · 140 阅读 · 0 评论 -
Codeforces Round #559 (Div. 2) C. The Party and Sweets(二分)
nnboys andmmgirls came to the party. Each boy presented each girl some integer number of sweets (possibly zero). All boys are numbered with integers from11tonnand all girls are numbered with in...原创 2019-05-13 18:05:25 · 523 阅读 · 0 评论 -
ZOJ - 3203——Light Bulb(三分)
题目链接:https://cn.vjudge.net/contest/277059#problem/G题意:给出H,h,D求L.思路;做辅助线,用相似三角形求X,然后三分。D/x=(H-y)/h-y L=x+y得 L=x+(x*H-D*h)/(x-D)三分求x即可求出答案。(注意x的取值范围)#include<algorithm>#...原创 2019-03-07 16:58:06 · 137 阅读 · 0 评论 -
POJ - 3320——Jessica's Reading Problem(尺取)
题目链接:https://vjudge.net/contest/277059#problem/A博客资源:https://blog.csdn.net/doubleguy/article/details/81265327思路:尺取法,设置l,r两个窗口,右边窗口每次向右移动1位。左边窗口出现重复时向右移动1位。当两边窗口中条件满足时,记录最小值。#include<algorith...原创 2019-03-02 21:14:25 · 152 阅读 · 0 评论 -
HDU - 1551——Cable master (二分卡精度)
Inhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has volunteered and has promised to organize the most honest contest ever. It was decided to co...原创 2018-05-16 20:41:41 · 164 阅读 · 0 评论 -
CodeForces - 785C——C. Anton and Fairy Tale(等差二分)
Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale:"Once upon a time, there lived an emperor. He was very rich and h...原创 2018-05-19 08:40:45 · 260 阅读 · 0 评论 -
HDU - 6197(最长单调子序列n(logn))
One day, Kaitou Kiddo had stolen a priceless diamond ring. But detective Conan blocked Kiddo's path to escape from the museum. But Kiddo didn't want to give it back. So, Kiddo asked Conan a question. ...原创 2018-04-20 14:52:30 · 263 阅读 · 0 评论 -
Kattis - speed
Sheila is a student and she drives a typical student car: it is old, slow, rusty, and falling apart. Recently, the needle on the speedometer fell off. She glued it back on, but she might have placed i...原创 2018-04-13 13:42:31 · 258 阅读 · 0 评论 -
HDU - 1251
Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). Input 输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提...原创 2018-04-17 20:23:12 · 130 阅读 · 0 评论 -
二分查找个人领悟
感谢:https://blog.csdn.net/mengxiang000000/article/details/52751310这位大佬让我看对二分有了更深入的理解。对于二分我的疑惑点在于while(l<=r)这里,而今看了大佬代码让我解开了疑惑;假如给出0 2 4 6 8 10 12......200,然后给出一个数比如40,然后你需要在数组中找出一个数存不存在。比如150,枚举在于较多...原创 2018-04-02 21:47:43 · 159 阅读 · 1 评论 -
Codeforces Round #561 (Div. 2) C. A Tale of Two Lands (二分)
C. A Tale of Two Landstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe legend of the foundation of Vectorland talks of two int...原创 2019-05-18 16:59:34 · 546 阅读 · 0 评论