随笔分类 -  二分

摘要:比赛的时候没看这个题,其实很简单,两次二分即可求出答案。#includeusing namespace std;#define inf 0x3f3f3f3f#define ll long longconst int maxn=100005;const double e... 阅读全文
posted @ 2018-08-21 22:55 MCQ 阅读(131) 评论(0) 推荐(0)
摘要:#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing ... 阅读全文
posted @ 2018-08-13 14:29 MCQ 阅读(186) 评论(0) 推荐(0)
摘要:题意:有N条绳子,他们的长度分别为Li,如果从它们中切割出k条长度相同的绳子的话,这K条绳子每条最大能有多长?方法:二分。注意:题目要求保留两位小数且不进位,导致我WA无数次,利用floor(ans*100) /100即可。#include#include#inclu... 阅读全文
posted @ 2018-08-13 13:59 MCQ 阅读(131) 评论(0) 推荐(0)
摘要:典型的最大化最小值问题,二分解决。注意:肯定有解,所以最小的解就是数组中最小的值。二分的时候注意l和r的取值,不然会WA或出不来结果,在这里l=mid+1,r=mid。#includeusing namespace std;#define inf 0x3f3f3f3f... 阅读全文
posted @ 2018-08-13 12:56 MCQ 阅读(137) 评论(0) 推荐(0)