随笔分类 - 贪心
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=5037贪心,一个月没做题了,这道题卡了半天0 0~只要考虑清楚走两个时,为了保证最优,使得距离要是L+1,如果小于这个值,会导致能直接走到这里,就不是最优了题目要求最差情况下青蛙走的最佳情况,所以每次开始都使他只走...
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4334二分T。。/************************************************* Author :Powatr* Created Time :2015-8-25 ...
阅读全文
摘要:http://acm.fzu.edu.cn/problem.php?pid=2141/*大意:把一张图分成一个二分图,使得任意相邻的顶点不在同一个集合里面,*//************************************************* Author :Powa...
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=5399/*先特判有重复数的情况,如果有就输出-1如果全是数字那么就判是否符合条件剩下的就是m!的(cout-1)次*//***********************************************...
阅读全文
摘要:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3829/*题意:要求变成合法的串需要操作多少次有两个操作1.添加 2.交换先扫一遍得到肯定要添的数字从前往后,如果发现有数字n++,如果n#include #include...
阅读全文
摘要:http://codeforces.com/problemset/problem/446/A/*贪心,开前缀后缀,枚举,每个i*//************************************************* Author :Powatr* Created Tim...
阅读全文
摘要:Problem DescriptionIn ann∗mmaze, the right-bottom corner is the exit (position(n,m)is the exit). In every position of this maze, there is either a0or ...
阅读全文
摘要:A colored stripe is represented by a horizontal row ofnsquare cells, each cell is pained one ofkcolors. Your task is to repaint the minimum number of ...
阅读全文
摘要:DZY has a sequencea, consisting ofnintegers.We'll call a sequenceai, ai + 1, ..., aj(1 ≤ i ≤ j ≤ n)a subsegment of the sequencea. The value(j - i + 1)...
阅读全文
摘要:DescriptionA tourist hiked along the mountain range. The hike lasted forndays, during each day the tourist noted height above the sea level. On thei-t...
阅读全文
摘要:There arenpiles of pebbles on the table, thei-th pile containsaipebbles. Your task is to paint each pebble using one of thekgiven colors so that for e...
阅读全文
摘要:You have a positive integermand a non-negative integers. Your task is to find the smallest and the largest of the numbers that have lengthmand sum of ...
阅读全文
摘要:Problem DescriptionPog and Szh are playing games.There is a sequence with $n$ numbers, Pog will choose a number A from the sequence. Szh will choose a...
阅读全文
摘要:Problem DescriptionAs this term is going to end, DRD needs to prepare for his final exams.DRD hasnexams. They are all hard, but their difficulties are...
阅读全文
摘要:Little girl Susie went shopping with her mom and she wondered how to improve service quality.There arenpeople in the queue. For each person we know ti...
阅读全文
摘要:Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining ...
阅读全文
摘要:Problem DescriptionTom and Jerry are playing a game with tubes and pearls. The rule of the game is:1) Tom and Jerry come up together with a number K.2...
阅读全文
摘要:DescriptionGiven set of line segments [Li, Ri] with integer coordinates of their end points. Your task is to find the minimal subset of the given set ...
阅读全文
摘要:DescriptionFunctioning of a scientific conference is usually divided into several simultaneous sections. For example, there may be a section on parall...
阅读全文
摘要:DescriptionAccounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc.All...
阅读全文