
贪心
文章平均质量分 67
弱菜zc
打完这场就回老家结婚!
展开
-
BestCoder Round #79 1002/hdu 5661 Claris and XOR 贪心
题目链接题意:给出四个数a,b,c,d。选择a考虑从高位到低位贪心,对于每一位,如果x,y只有唯一的取法,那么只能这么取;否则贪心地必须使答案的这一位等于1。如果x,y都是0,1都能取,则设这是从右向左数第len位,因为x,y能取的值一定都是连续的一段,因此x,y的后len位都能取0111...1(len-1个1)和1000...0(len-1个0)(否则做不到从右向左数第len位都能原创 2016-04-11 11:38:20 · 813 阅读 · 0 评论 -
【2013南京现场赛】1002 hdu4803 Poor Warehouse Keeper 贪心
Problem DescriptionJenny is a warehouse keeper. He writes down the entry records everyday. The record is shown on a screen, as follow:There are only two buttons on the screen. Pressing the b原创 2017-09-11 11:51:58 · 590 阅读 · 0 评论 -
【2017广西邀请赛】hdu 6188 Duizi and Shunzi 贪心
Problem DescriptionNike likes playing cards and makes a problem of it.Now give you n integers, ai(1≤i≤n)We define two identical numbers (eg: 2,2) a Duizi,and three consecutive positive原创 2017-09-06 10:37:25 · 554 阅读 · 0 评论 -
【多校训练】hdu 6178 Monkeys 贪心+dfs+读入挂模版
Problem DescriptionThere is a tree having N vertices. In the tree there are K monkeys (K <= N). A vertex can be occupied by at most one monkey. They want to remove some edges and leave minimum edg原创 2017-08-25 21:43:25 · 642 阅读 · 0 评论 -
【多校训练】hdu 6180 Schedule 贪心+set
Problem DescriptionThere are N schedules, the i-th schedule has start time si and end time ei (1 timeend and timestart , where time_{end} is time to turn off the machine and timestart is t原创 2017-08-24 20:50:37 · 685 阅读 · 0 评论 -
ZOJ 2132 The Most Frequent Number 贪心
Seven (actually six) problems may be somewhat few for a contest. But I am really unable to devise another problem related to Fantasy Game Series. So I make up an very easy problem as the closing probl原创 2017-06-24 21:32:01 · 473 阅读 · 0 评论 -
UVALive - 4378 Hell on the Markets 贪心
从大到小排序,如果当前和小于零则加,大于零则减,判断最后是否收敛于零。#include #include#define ll long longusing namespace std;const int N=110000;int n,v[N];struct node{ int i; ll num;}a[N];bool cmp(node a,node b)原创 2017-06-24 21:26:12 · 430 阅读 · 0 评论 -
2016 Multi-University Training Contest 5 1003 Divide the Sequence
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5783题目:Problem DescriptionAlice has a sequence A, She wants to split A into as much as possible continuous subsequences, satisfying that for each s原创 2016-08-08 16:00:51 · 665 阅读 · 0 评论 -
hdu 4004 The Frog's Games 二分+贪心
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4004题意:一条长L,(1思路:二分跳跃的最小距离,然后贪心判断是否能跳过。#include #includeusing namespace std;int a[550000],n,m,L;int ok(int k){ int num=1,last0=a[0]原创 2016-07-02 09:53:57 · 517 阅读 · 0 评论 -
51nod 1091 线段的重叠 贪心
题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1091题目:X轴上有N条线段,每条线段包括1个起点和终点。线段的重叠是这样来算的,[10 20]和[12 25]的重叠部分为[12 20]。给出N条线段的起点和终点,从中选出2条线段,这两条线段的重叠部分是最长的。输出这个最长的距离。如果没有原创 2016-06-07 18:16:26 · 1317 阅读 · 0 评论 -
51nod 1133 不重叠的线段 贪心
题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1133题目:X轴上有N条线段,每条线段有1个起点S和终点E。最多能够选出多少条互不重叠的线段。(注:起点或终点重叠,不算重叠)。例如:[1 5][2 3][3 6],可以选[2 3][3 6],这2条线段互不重叠。Input原创 2016-06-07 19:14:41 · 1402 阅读 · 0 评论 -
51nod 1182 完美字符串
题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1182题目:约翰认为字符串的完美度等于它里面所有字母的完美度之和。每个字母的完美度可以由你来分配,不同字母的完美度不同,分别对应一个1-26之间的整数。约翰不在乎字母大小写。(也就是说字母F和f)的完美度相同。给定一个字符串,输出它的最大可能原创 2016-06-07 19:26:31 · 766 阅读 · 0 评论 -
51nod 1128 正整数分组 V 二分+贪心
题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1128题意:给出一个长度为N的正整数数组,不改变数组元素的顺序,将这N个数分为K组。各组中元素的和分别为S1,S2....Sk。如何分组,使得S1至Sk中的最大值最小?例如:1 2 3 4 5 6分为3组,{1 2 3} {4 5} {6},元素原创 2016-06-08 09:23:48 · 1356 阅读 · 0 评论 -
51nod 1428 活动安排问题 优先队列+贪心
题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1428题目:有若干个活动,第i个开始时间和结束时间是[Si,fi),同一个教室安排的活动之间不能交叠,求要安排所有活动,最少需要几个教室? Input第一行一个正整数n (n <= 10000)代表活动的个数。第二行到第(n + 1)行原创 2016-06-09 23:00:39 · 933 阅读 · 0 评论 -
51nod 1432 独木舟 贪心
题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1432 题目:n个人,已知每个人体重。独木舟承重固定,每只独木舟最多坐两个人,可以坐一个人或者两个人。显然要求总重量不超过独木舟承重,假设每个人体重也不超过独木舟承重,问最少需要几只独木舟?Input第一行包含两个正整数n (0<n<原创 2016-06-10 17:06:01 · 685 阅读 · 0 评论 -
【2017沈阳网络赛】1012 hdu6205 card card card 贪心
Problem DescriptionAs a fan of Doudizhu, WYJ likes collecting playing cards very much. One day, MJF takes a stack of cards and talks to him: let's play a game and if you win, you can get all the原创 2017-09-11 11:15:40 · 541 阅读 · 0 评论