二分、贪心
二分、贪心
G_Meteor
AKK
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
18北邮计算机院-D.最长平衡子串 //哈希+贪心
题目描述 给定只含01的字符串,找出最长平衡子串的长度(平衡串:包含0和1的个数相同),串长最大10^6 输入 一个字符串,只包含01,长度不超过1000000 输出 一行一个整数,最长的0与1的个数相等的子串的长度。 示例输入 3 1011 1111 1010 示例输出 2 0 4 思路:将0看做-1,求前i项和,当前i项和为0时,以此元素为结尾的最长长度为当前下...原创 2020-02-10 18:19:52 · 716 阅读 · 0 评论 -
18北邮网研院-D.最大价值 //贪心
题目描述 对于每一个零件都有一个适宜温度区间,[Ri,Ji],当温度t<Ri,零件价值为x,当t>Ji,零件价值为z;当温度适宜,价值为y。且y>x,y>z。此刻,有一恒温箱,可确定温度t。 输入 第一行按顺序分别为 n,x,y,z。0<n<20000 接下来n行为 每一个零件的适宜温度区间0<Ri<Ji<10^9 输出 确定一个温度值t,...原创 2020-02-07 18:22:52 · 568 阅读 · 0 评论 -
二分贪心 B - 02
Description You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand the原创 2017-04-21 09:44:44 · 497 阅读 · 0 评论 -
二分贪心 E - 05
Description Farmer John has built a new long barn, with N (2 His C (2 <= C <= N) cows don't like this barn layout and become aggressive towards each other once put into a stall. To prevent th原创 2017-04-21 09:55:08 · 415 阅读 · 0 评论 -
二分贪心 U - 21
Description Little Bob likes playing with his box of bricks. He puts the bricks one upon another and builds stacks of different height. "Look, I've built a wall!", he tells his older sister Alice原创 2017-04-29 20:25:42 · 351 阅读 · 0 评论 -
二分贪心 T - 20
Description A factory produces products packed in square packets of the same height h and of the sizes 1*1, 2*2, 3*3, 4*4, 5*5, 6*6. These products are always delivered to customers in the square原创 2017-04-29 20:42:08 · 330 阅读 · 0 评论 -
二分贪心 X - 24
Description The whole family was excited by the news. Everyone knew grandpa had been an extremely good bridge player for decades, but when it was announced he would be in the Guinness Book of Wor原创 2017-04-30 20:05:03 · 312 阅读 · 0 评论 -
二分贪心 F - 06
Description 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原创 2017-04-30 20:16:12 · 293 阅读 · 0 评论 -
二分贪心 D - 04
Description The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A x B x C x D are such that a + b + c + d = 0原创 2017-04-30 21:43:10 · 370 阅读 · 0 评论 -
二分贪心 G - 07
Description When a thin rod of length L is heated n degrees, it expands to a new length L'=(1+n*C)*L, where C is the coefficient of heat expansion. When a thin rod is mounted on two solid walls原创 2017-05-01 20:27:13 · 317 阅读 · 0 评论
分享