![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
贪心
Charon_HN
NLP炼丹儿
展开
-
codeforces 994B 贪心+multiset容器优化
http://codeforces.com/problemset/problem/994/B 题目很容易理解,就是有n个骑士,他们都有自己的战斗值,而且每个人的身上都有一定的硬币,每个骑士是可以杀掉战斗值比自己小的骑士并能够得到他的硬币,但是每个骑士不能杀超过k个人,求每个骑士可以获得的最大钱数。 这道题是一道贪心题,开始我以为,局部最优,开始将所有的骑士的硬币数从大到小的顺序排一遍,然后每次...原创 2018-08-11 20:32:57 · 148 阅读 · 0 评论 -
最大乘积 YTU3283
3283: 最大乘积 题目描述 对于n个数,从中取出m个数,如何取使得这m个数的乘积最大呢? 输入 第一行一个数 代表数据组数 每组数据共两行 第一行两个正整数n、m, n,m<=20 第二行给出n个整数,其中每个数的绝对值小于4 输出 每组数据输出1行,为最大的乘积 样例输入 1 5 5 1 2 3 4 2 样例输出 48 先将所给的数据从小到大排一下,如...原创 2018-09-03 18:37:08 · 142 阅读 · 0 评论 -
POJ 1065 贪心+链-反链-Dilworth定理的应用+ POJ3636 排序方案的不同
Wooden Sticks Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 26050 Accepted: 11277 Description There is a pile of n wooden sticks. The length and weight of each stick...原创 2018-09-20 16:24:07 · 148 阅读 · 0 评论 -
POJ 3045 数学证明贪心解决 OR 二分
Farmer John's N (1 <= N <= 50,000) cows (numbered 1..N) are planning to run away and join the circus. Their hoofed feet prevent them from tightrope walking and swinging from the trapeze (and the...原创 2018-10-20 17:31:52 · 306 阅读 · 1 评论 -
ZOJ 4110 Strings in the Pocket 回文串+马拉车
BaoBao has just found two stringsandin his left pocket, whereindicates the-th character in string, andindicates the-th character in string. As BaoBao is bored, he decides to select a subs...原创 2019-04-29 14:09:36 · 232 阅读 · 0 评论 -
2019山东省省赛H题 ---zoj4120
Tokens on the Segments Sample Input 2 3 1 2 1 1 2 3 3 1 2 1 1 2 2 Sample Output 3 2 Hint For the first sample test case, one can put three tokens separately on (1, 2), (2, 1) and (3, 3). For the seco...原创 2019-05-15 20:38:22 · 410 阅读 · 0 评论 -
2019牛客暑期多校训练营(第七场) A String
样例输入: 4 0 0001 0010 111011110 样例输出: 0 0001 001 0 111 01111 0 分析: 一开始打算是先用分块的思想,每次对只含有01的串进行连接,判断是否是可以连接的,但是,,,,,这种情况的判断出现问题了,导致这个暴力的题目用了5个小时才A,QWQ 然后就去看了一下大佬的代码,处理的方法就是枚举最长的串可以是多长,这样就保证了切割原串是最小的次数; ...原创 2019-08-09 09:23:08 · 196 阅读 · 0 评论