
二分
数论
Aloof__
笔记是记忆的缓冲
展开
-
AcWing 102. 最佳牛围栏(二分)
农夫约翰的农场由NN块田地组成,每块地里都有一定数量的牛,其数量不会少于1头,也不会超过2000头。约翰希望用围栏将一部分连续的田地围起来,并使得围起来的区域内每块地包含的牛的数量的平均值达到最大。围起区域内至少需要包含FF块地,其中FF会在输入中给出。在给定条件下,计算围起区域内每块地包含的牛的数量的平均值可能的最大值是多少。输入格式第一行输入整数NN和FF...原创 2020-04-08 11:29:34 · 315 阅读 · 0 评论 -
牛客练习赛59—C:装备合成
链接:https://ac.nowcoder.com/acm/contest/4743/C来源:牛客网题目描述牛牛有x{x}x件材料a{a}a和y{y}y件材料b{b}b,用2{2}2件材料a{a}a和3{3}3件材料b{b}b可以合成一件装备,用4{4}4件材料a{a}a和1{1}1件材料b{b}b也可以合成一件装备。牛牛想要最大化合成的装备的数量,于是牛牛找来了你帮忙。输入描...原创 2020-03-14 18:20:15 · 4041 阅读 · 1 评论 -
Codeforces Round #620 (Div. 2)(D. Shortest and Longest LIS)
DescriptionGildong recently learned how to find the longest increasing subsequence (LIS) in O(n log n)O(n\ log\ n)O(n log n) time for a sequence of length nnn. He wants to test himself if he can impl...原创 2020-02-18 00:29:24 · 1122 阅读 · 0 评论 -
2020牛客寒假算法基础集训营5:B.牛牛战队的比赛地(二分/三分)
链接:https://ac.nowcoder.com/acm/contest/3006/B来源:牛客网题目描述由于牛牛战队经常要外出比赛,因此在全国各地建立了很多训练基地,每一个基地都有一个坐标(x,y)(x,y)。这周末,牛牛队又要出去比赛了,各个比赛的赛点都在xx轴上。牛牛战队为了方便比赛,想找一个到达训练基地最大距离最小的地方作为比赛地。这个问题对于牛牛战队太简单了,它就交给了你,...原创 2020-02-14 12:28:49 · 4090 阅读 · 1 评论 -
2020牛客寒假算法基础集训营1
整体难度codeforces div3水平(但我感觉挺难的)A:honoka和格点三角形这道题有点卡模吧,容斥定理的思想:首先先算一条边平行于轴的情况:底边可以是1或2,(n-2)*(m-1)*m * 2 + (m-2) *m * (n-1) *2再算一条边平行于y轴的情况:底边同样有两种情况:(n-1) *(m-2)*n * 2 + (n-2) *n * (m-1) *2再减去...原创 2020-02-04 19:53:16 · 231 阅读 · 0 评论 -
牛客小白月赛17 F小黄鸭(计算几何+积分+二分)
链接:https://ac.nowcoder.com/acm/contest/1085/F来源:牛客网题目描述小sun的寝室有一只小黄鸭,小黄鸭浮在水面上的样子特别可爱,现在小sun有一个问题:为了简单,我们把小黄鸭视为一个均匀的球体,它浮在水面上的样子大概为:图中黑色的线即为水平线,灰色的部分为没在水中的部分,现在你要求的是,这个球体浮在水面上的部分的高度(即为图中的h)。高度定义...原创 2019-10-08 20:34:18 · 450 阅读 · 0 评论 -
Free Weights Gym - 101170F(二分或者暴力)
The city of Bath is a noted olympic trainingground—bringing local, national, and even internationalteams to practice. However, eventhe finest gymnasium falls victim to the cardinalsin. . .Weights ...原创 2019-10-07 00:19:02 · 372 阅读 · 0 评论 -
Aggressive cows POJ - 2456(二分)
Farmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,…,xN (0 <= xi <= 1,000,000,000).His C (2 <= C <...原创 2019-08-31 09:56:53 · 174 阅读 · 0 评论 -
pairs HDU - 5178 (二分)
John has n points on the X axis, and their coordinates are (x[i],0),(i=0,1,2,…,n−1). He wants to know how many pairs<a,b> that |x[b]−x[a]|≤k.(a<b)InputThe first line contains a single integ...原创 2019-08-29 17:22:07 · 235 阅读 · 0 评论 -
Can you find it? HDU - 2141 二分模板
Give you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbers Ai, Bj, Ck, which satisfy the formula Ai+Bj+Ck = X.InputThere ar...原创 2019-08-29 15:57:46 · 166 阅读 · 0 评论 -
Strange fuction HDU - 2899(二分)-水
Now, here is a fuction:F(x) = 6 * x^7 +8x^6+ 7x^3+ 5x^2-yx (0 <= x <=100)Can you find the minimum value when x is between 0 and 100.InputThe first line of the input contains an integer T(1&...原创 2019-08-29 15:28:16 · 154 阅读 · 0 评论 -
The Frog's Games HDU - 4004(二分加贪心)
The annual Games in frogs’ kingdom started again. The most famous game is the Ironfrog Triathlon. One test in the Ironfrog Triathlon is jumping. This project requires the frog athletes to jump over th...原创 2019-08-28 19:06:35 · 254 阅读 · 0 评论 -
Trailing Zeroes (III) LightOJ - 1138(二分)
You task is to find minimal natural number N, so that N! contains exactly Q zeroes on the trail in decimal notation. As you know N! = 12…*N. For example, 5! = 120, 120 contains one zero on the trail....原创 2019-08-28 17:33:32 · 121 阅读 · 0 评论 -
Pie HDU - 1969 二分
My birthday is coming up and traditionally I’m serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party and each of ...原创 2019-08-26 16:51:13 · 144 阅读 · 0 评论 -
二分查找模板
例如数组中查询一个数二分查找的前提是整个数组是有序的;模板int a[n];int l=0,r=n-1;int mid,key;while(l<=r){ mid=(r-l)/+l; if(a[mid]>key) r=mid-1; else if(a[mid]<key) l=mid+1; else break;//此时a[mid]=ke...原创 2019-08-09 17:27:36 · 179 阅读 · 0 评论