![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
贪心
文章平均质量分 61
elbadaernu
这个作者很懒,什么都没留下…
展开
-
Dreamoon and Stairs CodeForces - 476A
Dreamoon and Stairs CodeForces - 476A题目描述 Dreamoon wants to climb up a stair of n steps. He can climb 1 or 2 steps at each move. Dreamoon wants the number of moves to be a multiple of an integer m.Wha原创 2017-02-13 11:24:30 · 506 阅读 · 0 评论 -
Minimal string CodeForces - 797C
Petya recieved a gift of a string s with length up to 10^5 characters for his birthday. He took two more empty strings t and u and decided to play a game. This game has two possible moves: 1.Extra原创 2017-08-21 21:14:22 · 614 阅读 · 0 评论 -
codevs 2610 活动选择(贪心)(测试数据有错)
题目描述 Description 假设有一个需要使用某一资源的n(n≤1000)个活动组成的集合S,S={1,…,n}。该资源一次只能被一个活动占有,每一个活动有一个开始时间bi和结束时间ei(bi≤ei)。若bi>ej或者bj>ei,则活动i和活动j兼容。你的任务是是:选择由互相兼容的活动组成的最大集合。输入描述 Input Description 共n+1行,其中第1行为n,第2行到第n+1原创 2017-06-24 20:24:45 · 588 阅读 · 0 评论 -
codevs 2072 分配房间(贪心+二分)
题目描述 Description yh拥有一条街道,街道上共有n间房子,每间房子的坐标为xi(yh的房子比较神奇,可能重叠)。同时,yh有m个女朋友(这是事实),yh打算给每位女朋友分配一间房子。两个女朋友间的距离相隔越近,她们之间产生冲突的可能就越高。yh想尽可能的减小女朋友间的冲突,于是他打算让他的女朋友间的最小距离最大,你能帮yh找出这个最大值吗?输入描述 Input Description原创 2017-05-19 10:47:31 · 396 阅读 · 0 评论 -
codevs 1725 探险(简单二分)
题目描述 Description 有编号为1至n的n个同学一起去探险,现在把他们分成k个小组,每个小组完成一项探险任务。分组时,如果第i人与第j人分在同一组(i < j),则他们之间的所有人(第i+1,i+2,…,j-1个)也必须在同一个小组中。一个小组内所有人的体力和越小,途中可能越危险。为了确保每个同学的安全,要求分组时,使得所有小组中,体力和最小的那个小组的所有人的体力和尽量大。依次告诉你每原创 2017-05-26 22:11:29 · 1399 阅读 · 0 评论 -
Educational Codeforces Round 21 C
C. Tea PartyPolycarp invited all his friends to the tea party to celebrate the holiday. He has n cups, one for each of his n friends, with volumes a1, a2, …, an. His teapot stores w milliliters of tea原创 2017-05-16 15:31:09 · 422 阅读 · 0 评论 -
codevs 1643 线段覆盖 3(贪心+快排)
题目描述 Description 在一个数轴上有n条线段,现要选取其中k条线段使得这k条线段两两没有重合部分(端点可以重合),问最大的k为多少。输入描述 Input Description 输入格式输入文件的第1行为一个正整数n,下面n行每行2个数字ai,bi,描述每条线段。输出描述 Output Description 输出格式 输出文件仅包括1个整数,为k的最大值样例输入 Sample原创 2017-05-25 23:00:37 · 419 阅读 · 0 评论 -
codevs 1214 线段覆盖(贪心 or dp)
题目描述 Description 给定x轴上的N(0< N<100)条线段,每个线段由它的二个端点a_I 和b_I确定,I=1,2,……N.这些坐标都是区间(-999,999)的整数。有些线段之间会相互交叠或覆盖。请你编写一个程序,从给出的线段中去掉尽量少的线段,使得剩下的线段两两之间没有内部公共点。所谓的内部公共点是指一个点同时属于两条线段且至少在其中一条线段的内部(即除去端点的部分)。原创 2017-05-25 21:32:50 · 362 阅读 · 0 评论 -
2017 华东师范大学网赛 F 丽娃河的狼人传说
丽娃河是华师大著名的风景线。但由于学校财政紧缺,丽娃河边的路灯年久失修,一到晚上就会出现走在河边要打着手电的情况,不仅非常不方便,而且影响安全:已经发生了大大小小的事故多起。方便起见,丽娃河可以看成是从 1 到 n 的一条数轴。为了美观,路灯只能安装在整数点上,每个整数点只能安装一盏路灯。经专业勘测,有 m 个区间特别容易发生事故,所以至少要安装一定数量的路灯,请问至少还要安装多少路灯。Input第原创 2017-05-13 10:21:19 · 656 阅读 · 0 评论 -
coedvs 2744养鱼喂妹纸(二分+贪心)
题目描述 Description 在某岛国,大多数居民都是渔民,这个国家的所有城镇都沿直线分布在海边。渔民们捕获大量的海鱼,但就象世界上大多数的渔民一样,他们并不喜欢吃鱼,所以他们决定从天朝收养一些贫困家庭的女孩纸,让她们来帮着吃鱼,顺便(和谐),国家规定每个城镇收养的贫困妹纸数量必须相等,这样才能建设和谐社会。一条又长又直的公路贯穿整个海岸将所有的城镇连接了起来,所以每个城镇(除去第一个原创 2017-05-22 12:41:53 · 390 阅读 · 0 评论 -
New Year Book Reading CodeForces - 500C
New Year Book Reading CodeForces - 500C题目描述 New Year is coming, and Jaehyun decided to read many books during 2015, unlike this year. He has n books numbered by integers from 1 to n. The weight of the转载 2017-03-25 20:57:02 · 348 阅读 · 0 评论 -
DZY Loves Modification CodeForces - 446B
DZY Loves Modification CodeForces - 446B题目描述As we know, DZY loves playing games. One day DZY decided to play with a n × m matrix. To be more precise, he decided to modify the matrix with exactly k oper转载 2017-03-23 19:38:17 · 339 阅读 · 0 评论 -
Appleman and Card Game CodeForces - 462B
Appleman and Card Game CodeForces - 462B题目描述 Appleman has n cards. Each card has an uppercase letter written on it. Toastman must choose k cards from Appleman’s cards. Then Appleman should give Toastm原创 2017-03-22 14:09:25 · 424 阅读 · 0 评论 -
HDU 景女神与她的托福
HDU 景女神与她的托福景女神与她的托福 Problem Description 景女神最近一直在恶补英语,她要为了她的托福做准备。于是,满神给景女神出了一道题,来帮助景女神学习英语。 满神给了景女神一个长度为n的字符串,字符串只包含小写字母 a,b;并且告诉景女神她最多可以改变k个字符(a->b, b->a);满神想知道经过不超过k次的改变后,出现相同字母的字符串(连续)的最大长度是多少。原创 2017-03-09 12:35:33 · 413 阅读 · 0 评论 -
George and Round CodeForces - 387B
George and Round CodeForces - 387B题目描述George decided to prepare a Codesecrof round, so he has prepared m problems for the round. Let’s number the problems with integers 1 through m. George estimates th原创 2017-02-03 23:09:06 · 660 阅读 · 0 评论 -
Sticks POJ - 1011 (暴力dfs+剪枝)
George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how many sticks he had origi原创 2017-08-26 14:07:52 · 330 阅读 · 0 评论