
二分&&三分
UCAS王小二
不念过去,不畏未来...
展开
-
Educational Codeforces Round 53 (Rated for Div. 2)
C. Vasya and Robot 【二分】暴力左端点,二分右端点。在[L,R]区间内任意填方向,根据区间外的方向值和终点(x,y)计算出此区间需要能否填成。判断式:r - l >= abs(res1) + abs(res2) && (r - l - abs(res1) - abs(res2)) % 2 == 0.#include <bits/stdc++.h&...原创 2018-11-02 12:02:05 · 230 阅读 · 1 评论 -
Wannafly挑战赛26
链接:https://www.nowcoder.com/acm/contest/212/A作为「Misaka Network」的中心司令塔的 LastOrder出事了,为了维持 「Misaka Network」的正常工作,需要临时选出一个Sister作为中心司令塔。为了弥补能力上的不足,对于选出的Sister有一些要求。具体来说,平面上有 n 个 Sister,问能否找到一个Sister作为...原创 2018-10-16 17:00:33 · 203 阅读 · 0 评论 -
2354: 分班级【二分】
题目描述 Zoro是一个有强迫症的人,他喜欢均衡。 17级的新生要开学了,起初所有班级是按照学生的来源地分的,各班人数非常不合理。于是老师要求Zoro来让各班人数均衡一下。 由于学校系统陈旧,每次调换只能是Zoro自己手动的把一个学生从一个班级拉到另外一个班级,由于Zoro有强迫症,他每次会找出班级人数最多的那个拉出一个人转到一个人数最少的班级,而且每次操作,耗原创 2017-09-04 12:36:53 · 305 阅读 · 0 评论 -
Clarke and number 【sqrt精度+打表找规律】
基准时间限制:1 秒 空间限制:32768 KB 分值: 80 克拉克是一名人格分裂患者.某一天克拉克变成了一名数论研究者,在研究数字. 他想到了一个题:给定非负整数 x 和正整数 k ,可以做若干操作,每次操作是以下两种方法之一: 1. x=x−k 2. x=⌊x√⌋2 现在克拉克想知道,这个整数最少经过多少次操作可以变成 0 .Input 第一行是一个正整数T(1≤T≤100),原创 2017-07-29 10:29:21 · 428 阅读 · 0 评论 -
hdu 5246 超级赛亚ACMer【二分or模拟】
超级赛亚ACMerTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2931 Accepted Submission(s): 803Problem Description百小度是一个ACMer,也是一个超原创 2017-07-24 10:53:26 · 330 阅读 · 0 评论 -
1257 最少拦截系统【LIS+二分】
最少拦截系统Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 44354 Accepted Submission(s): 17299Problem Description某国为了防御敌国的导弹袭击,发展出原创 2017-08-08 10:11:36 · 273 阅读 · 0 评论 -
Educational Codeforces Round 25 D. Suitable Replacement【二分】
D. Suitable Replacementtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two strings s and t co原创 2017-07-19 20:46:29 · 425 阅读 · 0 评论 -
1275: God's ladder [DP]
1275: God's ladder [DP]时间限制: 1 Sec 内存限制: 128 MB Special Judge题目描述天明来到神之宫殿,在他眼前出现了若干个石柱,每个石柱上有1枚金币,天明可以任意选择一个石柱开始,然后向前方的石柱瞬移,而且他所瞬移到的石柱的高度必须要大于现在所在石柱的高度。求天明所能获得的最大金币数以及任意一种可以获得这么多金币的路线(每个石原创 2017-03-07 14:25:21 · 403 阅读 · 0 评论 -
poj3111 K Best【最大化平均值】
K BestTime Limit: 8000MS Memory Limit: 65536KTotal Submissions: 10485 Accepted: 2698Case Time Limit: 2000MS Special JudgeDescriptionDemy has n jewel原创 2017-07-19 16:00:45 · 343 阅读 · 0 评论 -
HDU - 1969(分蛋糕)【最大化平均值】
思路:(贪心 + 二分)第一步:先用贪心的方法找最优解,然后才能采用二分搜索出答案;(ps 贪心找最优解:原创 2017-01-11 00:44:29 · 1412 阅读 · 0 评论 -
poj 2456【最大化最小值】
Aggressive cowsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 14728 Accepted: 7098DescriptionFarmer John has built a new long barn, with N (2 His原创 2017-07-18 20:43:59 · 335 阅读 · 0 评论 -
Red packet NBUT - 1651【二分】
[1651] Red packet时间限制: 1000 ms 内存限制: 65535 K问题描述New Year is coming! Our big boss Wine93 will distribute some “Red Package”, just like Alipay and Wechat.Wine93 has m yuan, he decides to原创 2017-07-18 11:35:15 · 365 阅读 · 0 评论 -
(找数字)HDU - 2141
HDU - 2141Give 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.原创 2017-01-11 00:59:46 · 572 阅读 · 0 评论 -
(写公式,解方程)LightOJ - 1062
LightOJ - 1062 A narrow street is lined with tall buildings. An x foot long ladder is rested at the base of the building on the right side of the street and leans on the build原创 2017-01-11 01:25:28 · 371 阅读 · 0 评论 -
HDU-2199 A - Can you solve this equation(解方程)
HDU - 2199A - Can you solve this equation现在,给出等式8* X^4+ 7* X^3+ 2* X^2+ 3 * X +6=Y,请找出他在0和100之间的解(包含0和100)。现在,请你试试运气。。。。 Input输入的第一行包含一个整数T(1 10);Output对于每个测试用例,如果有解,你应该输出一个原创 2017-01-10 19:59:57 · 500 阅读 · 0 评论 -
HDU - 3586 Information Disturbing【树形dp+二分】
In the battlefield , an effective way to defeat enemies is to break their communication system.The information department told you that there are n enemy soldiers and their network which have n-1 comm原创 2017-11-13 08:56:51 · 327 阅读 · 0 评论 -
HPU 1195: Mod【二分&单调队列&思维】
Ocean用巧妙的方法得到了一个序列,该序列有N个元素,我们用数组a来记录(下标从0到N−1)。 Ocean定义f[i]=(((i%a[0])%a[1])%…)%a[N−1]。 现在Ocean会给出QQ次查询,每次给定一个区间[L,R],[L,R],他想快速知道∑Ri=Lf[i]∑i=LRf[i] (即f[L]+…+f[R]f[L]+…+f[R])的值。输入 第一行输入一个整数T,代表有T组测原创 2017-12-07 22:02:48 · 208 阅读 · 0 评论 -
HDU 2438 Turn the corner【三分+公式推导】
记录:我一直把拐角处作为三分点(让车以拐角处旋转),突然发现这个点并不固定,zz。。。应该让汽车靠着右侧和下侧移动(不考虑现实生活车技),建立坐标系如下图,三分角度(红色直线与x轴夹角),求出当y=Xy=Xy=X时的最大fabs(x)fabs(x)fabs(x),若小于街道yyy即“yes”“yes”“yes”.#include<bits/stdc++.h>using na...原创 2018-10-18 22:11:11 · 244 阅读 · 0 评论 -
hihocoder #1142 : 三分求极值【三分】
分析:【三分】三分最近距离的(xx,yy)(xx,yy)(xx,yy)中的xx,画图可知,对于P到曲线上任一点(x,y)(x,y)(x,y),并不是单峰问题。当 −INF&lt;xx&lt;=−b/2a-INF &lt; xx &lt;= -b / 2a−INF<xx<=−b/2a,对于P点到该曲线距离满足三分,同理−b/2a&lt;=xx&...原创 2018-10-18 19:53:51 · 238 阅读 · 0 评论 -
HDU 6383 p1m2【二分】
Problem Description 度度熊很喜欢数组!! 我们称一个整数数组为稳定的,若且唯若其同时符合以下两个条件: 1. 数组里面的元素都是非负整数。 2. 数组里面最大的元素跟最小的元素的差值不超过 1。 举例而言,[1,2,1,2] 是稳定的,而 [−1,0,−1] 跟 [1,2,3] 都不是。 现在,定义一个在整数数组进行的操作: * 选择数组中两个不同的元素 a 以及...原创 2018-08-13 22:41:02 · 179 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第五场)A gpa【二分(01分数规划)】
链接:https://www.nowcoder.com/acm/contest/143/A 来源:牛客网 题目描述 Kanade selected n courses in the university. The academic credit of the i-th course is s[i] and the score of the i-th course is c[i].At th...原创 2018-08-02 21:50:06 · 226 阅读 · 0 评论 -
POJ 3057 Evacuation【二分+最短路+最大流】
POJ 3057 Evacuation 题意:一幅迷宫图’.’为空格,’D’为门,’#’为墙;现在每个空格处有一人,且每个时刻每个门只能出去一人;当走到门时为离开房间;求所有人撤离的最短时间,否则impossible; 一个迷宫,’.’表示人,’D’表示门(只出现在迷宫四周),’X’表示墙(迷宫内和边缘都有),迷宫内起火了,里面内的人需要向外跑。一秒移动一格,一个门每秒只能出一个人,问最后一个...原创 2018-06-20 20:21:53 · 270 阅读 · 0 评论 -
牛客练习赛16 A B C F【思维+图染色+二分+数学公式】
A 字典序最大的子序列 链接:https://www.nowcoder.com/acm/contest/84/A 来源:牛客网 题目描述 给定字符串s,s只包含小写字母,请求出字典序最大的子序列。 子序列:https://en.wikipedia.org/wiki/Subsequence 字典序:https://en.wikipedia.org/wiki/L...原创 2018-04-27 21:54:53 · 278 阅读 · 0 评论 -
FZU 2216 The Longest Straight【二分||二分+树状数组+优化常数】
ZB is playing a card game where the goal is to make straights. Each card in the deck has a number between 1 and M(including 1 and M). A straight is a sequence of cards with consecutive values. Values ...原创 2018-04-25 09:30:01 · 190 阅读 · 0 评论 -
Codeforces Round #361 (Div. 2) C. Mike and Chocolate Thieves【二分】
Bad news came to Mike’s village, some thieves stole a bunch of chocolates from the local factory! Horrible! Aside from loving sweet things, thieves from this area are known to be very greedy. So...原创 2018-04-09 22:17:37 · 241 阅读 · 0 评论 -
Wannafly挑战赛13 E VVQ 与线段【二分预处理+线段树区间查询】
链接:https://www.nowcoder.com/acm/contest/80/E 来源:牛客网 题目描述 VVQ 最近迷上了线段这种东西 现在他手上有 n 条线段,他希望在其中找到两条有公共点的线段,使得他们的异或值最大。 定义线段的异或值为它们并的长度减他们交的长度 输入描述: 第一行包括一个正整数 n,表示 VVQ 拥有的线段条数。 接...原创 2018-04-08 21:26:00 · 348 阅读 · 0 评论 -
牛客练习赛13 A B C F【二分+思维】
链接:https://www.nowcoder.com/acm/contest/70/A 来源:牛客网 题目描述 定义一个数字为幸运数字当且仅当它的所有数位都是4或者7。 比如说,47、744、4都是幸运数字而5、17、467都不是。 现在,给定一个字符串s,请求出一个字符串,使得: 1、它所代表的整数是一个幸运数字; 2、它非空; 3、它作...原创 2018-03-21 18:01:47 · 286 阅读 · 0 评论 -
Codeforces Round #467 (Div. 2)【A B C D】
A - Olympiad The recent All-Berland Olympiad in Informatics featured n participants with each scoring a certain amount of points. As the head of the programming committee, you are to determine ...原创 2018-03-08 08:45:24 · 541 阅读 · 0 评论 -
CodeForces - 895
CodeForces - 895A Pizza SeparationStudents Vasya and Petya are studying at the BSU (Byteland State University). At one of the breaks they decided to order a pizza. In this problem pizza is a circle原创 2017-12-03 13:12:59 · 540 阅读 · 2 评论 -
HPU 1470: 中位数 【分治】
时间限制: 1 Sec 内存限制: 128 MB 题目描述 Ocean有两个升序序列A和B,现在他将A和B合并后得到新序列C,他想知道序列C的中位数。 输入 第一行输入一个整数T,代表有T组数据。每组数据第一行输入一个整数N,代表A、B序列元素个数。接下来一行依次输入N个整数,代表序列A的元素。接下来一行依次输入N个整数,代表序列B的元素。 注:1<=T<=5000,1原创 2018-01-01 18:19:57 · 291 阅读 · 0 评论