![](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行,为最大的乘积样例输入15 51 2 3 4 2样例输出48先将所给的数据从小到大排一下,如...原创 2018-09-03 18:37:08 · 142 阅读 · 0 评论 -
POJ 1065 贪心+链-反链-Dilworth定理的应用+ POJ3636 排序方案的不同
Wooden SticksTime Limit: 1000MS Memory Limit: 10000K Total Submissions: 26050 Accepted: 11277 DescriptionThere 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 · 303 阅读 · 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 SegmentsSample Input231 21 12 331 21 12 2Sample Output32HintFor 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 · 409 阅读 · 0 评论 -
2019牛客暑期多校训练营(第七场) A String
样例输入:4000010010111011110样例输出:00001001 0111 01111 0分析:一开始打算是先用分块的思想,每次对只含有01的串进行连接,判断是否是可以连接的,但是,,,,,这种情况的判断出现问题了,导致这个暴力的题目用了5个小时才A,QWQ然后就去看了一下大佬的代码,处理的方法就是枚举最长的串可以是多长,这样就保证了切割原串是最小的次数;...原创 2019-08-09 09:23:08 · 196 阅读 · 0 评论