![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
贪心
cherish__lin
I want to be better!
展开
-
B. Tape(贪心)
You have a long stick, consisting of mm segments enumerated from 11 to mm. Each segment is 11 centimeter long. Sadly, some segments are broken and need to be repaired.You have an infinitely long rep...原创 2019-02-14 16:45:51 · 273 阅读 · 0 评论 -
B. Yet Another Array Partitioning Task
An array bb is called to be a subarray of aa if it forms a continuous subsequence of aa, that is, if it is equal to alal, al+1al+1, ……, arar for some l,rl,r.Suppose mm is some known constant. For an...原创 2019-02-11 18:34:00 · 352 阅读 · 0 评论 -
D. Sea Battle(贪心)
Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of b consecutive cells. No cell can be part of two ships, however, ...原创 2019-02-12 00:59:37 · 251 阅读 · 0 评论 -
easy array problem
Problem Description给你一个序列s,长度为n。你需要找到一个长度为k的序列t使得它能被最多次数的从 s 中删除(可不连续且与顺序无关)。你的任务是找到一个序列t。如果有多个可行方案,输出字典序最小的一个序列。Input第一行两个正整数 n 和 k ,分别表示原始序列的长度和要删除序列的长度。第二行 n 个整数表示原始序列。1<=k<=n&l...原创 2019-02-27 20:58:18 · 113 阅读 · 0 评论 -
饭卡(背包+贪心)
电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。 某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡上的余额,问最少可使卡上的余额为多少。 Input多组数据。对于每组数据: 第一行为正整数n...原创 2019-02-14 00:28:09 · 166 阅读 · 0 评论 -
G - Supermarket(贪心)
A supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a deadline dx that is measured as an integral number of time units starting from the moment the s...原创 2019-03-10 20:06:40 · 163 阅读 · 0 评论 -
E - Equal Numbers Gym - 101612E
题目链接:http://codeforces.com/gym/101612/attachments题解:给出来n个数,进行i次操作使得进行i次操作后剩得的不同数字个数最少,注意这n次操作是最优值,这n次操作可能不连续!!!那么我们就想可以在原数组内变,如果一个数是另一个数的倍数,那么将另一个数变为该数,不同值就减少1,注意贪心从个数最少的数开始变。还有就是统一变成这n个数的最小公倍数(默认...原创 2019-05-08 22:05:18 · 208 阅读 · 0 评论