
贪心
尒轩窗
这个作者很懒,什么都没留下…
展开
-
Distinct Values
Problem Description Chiaki has an array of n positive integers. You are told some facts about the array: for every two elements ai and aj in the subarray al..r (l≤i<j≤r ), ai≠aj holds. Chiaki woul...原创 2018-07-23 21:14:16 · 603 阅读 · 0 评论 -
hdu 6000 Wash【优先队列+贪心】
题目链接 题意: l件衣服n个洗衣机,m个甩干机,一个洗衣机只能在一段时间内洗一件衣服,一个甩干机只能在一段时间内甩一件衣服,求最少的洗完甩完所有衣服的时间 分析: 优先队列+贪心 假设起始时间和终止时间已经知道,此时的终止时间固定 我们先用优先队列求出洗0...l件衣服分别最少的时间和甩干0...l件衣服分别最少的时间。 洗的最快的要和需要甩干时间最长的匹配,为什么会匹配成功呢...原创 2018-10-29 19:47:38 · 241 阅读 · 0 评论 -
2016 ICPC EC-Final 上海
A:Number Theory Problem 题意: 求比2^N小的,敲好等于(2^k)-1的同时是7的倍数的个数 分析: 暴力打表找出规律 代码: #include<bits/stdc++.h> #define ll long long #define inf 0x3f3f3f3f using namespace std; const int maxn=200010;...原创 2018-10-07 15:02:25 · 579 阅读 · 0 评论 -
2016 ACM/ICPC 沈阳区域赛E— Counting Cliques 【dfs】
题意: n(n<=100)个点,m(m<=1000)个边,每个点的度不超过20,的无向图,问里面有几个子图是s元完全图 分析: 暴力深搜加点小技巧,将双向边变成单向边,只从编号小的向编号大的建边,之后从小打到扫描点,记录路径,判断该点是否与之前路径中的点都有一条边,这是一种剪枝方法。同时判断当前路径中的点跟这个点的指向的的点和是否大于等于S,否则剪枝 代码: #in...原创 2018-10-06 21:26:16 · 350 阅读 · 0 评论 -
2016 ACM/ICPC 大连区域赛 F—Detachment【贪心+逆元】
http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1006&cid=736 Detachment Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 346 ...原创 2018-10-03 18:41:25 · 473 阅读 · 0 评论 -
城市规划【贪心】
链接:https://www.nowcoder.com/acm/contest/180/C 题目描述 小a的国家里有n个城市,其中第i和第i - 1个城市之间有无向道路连接,特殊的,第1个城市仅与第2个城市相连 为了减轻道路维护负担,城市规划局局长MXT给出了m个要求,他想让小a断开一些道路,使得任意1 ≤ i ≤ m ,城市xi不能到达城市yi 同时最小化断开道路的数量。 输...原创 2018-09-09 10:34:31 · 211 阅读 · 0 评论 -
HDU 6438 Buy and Resell【贪心】
http://acm.hdu.edu.cn/showproblem.php?pid=6438 Problem Description The Power Cube is used as a stash of Exotic Power. There are n cities numbered 1,2,…,n where allowed to trade it. The trading price...原创 2018-08-25 21:37:26 · 299 阅读 · 0 评论 -
C:Elections(枚举+贪心)Codeforces Round #503 (by SIS, Div. 2)
题意: n个人给m个人投票,可以通过钱把其他人的票买过来。。问至少花费多少钱可以使候选人1的票数最多 分析: 枚举每一种可能候选人1最后可能的票数,然后看是否存在所有人的票数小于他的可能,存在找到最小的花费,这个时候需要用到的是贪心的方法,要把钱从小到大排序就好 代码: #include<bits/stdc++.h> using namespace std; const i...原创 2018-08-13 21:02:29 · 197 阅读 · 0 评论 -
Maximum Mode
链接:https://www.nowcoder.com/acm/contest/142/G 题目描述 The mode of an integer sequence is the value that appears most often. Chiaki has n integers a1,a2,...,an. She woud like to delete exactly m of them ...原创 2018-07-29 10:03:37 · 203 阅读 · 0 评论 -
Balanced Sequence
http://acm.hdu.edu.cn/showproblem.php?pid=6299 Problem Description Chiaki has n strings s1,s2,…,sn consisting of '(' and ')'. A string of this type is said to be balanced: + if it is the e...原创 2018-07-24 21:34:09 · 243 阅读 · 0 评论 -
HDU 5303 Delicious Apples
http://acm.hdu.edu.cn/showproblem.php?pid=5303 题意: 有一条环形的长为L的路,仓库在位置0处,这条路上有n棵苹果树,给出每棵苹果树的位置和苹果数量,问用 一次最多能装K个苹果的篮子 把这条路上全部苹果採回仓库最少须要走的距离 分析: 半环拆成1半,左边的尽可能左走,右边的右走, 现在考虑一下绕圈: 由于2次绕圈可以拆成左右各来回一次,...原创 2018-07-18 20:51:37 · 142 阅读 · 0 评论 -
hdu 6075 Questionnaire【贪心】
题目链接 Questionnaire Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 1204 Accepted Submission(s): 800Special Judge Problem Description ...原创 2018-11-14 21:23:01 · 240 阅读 · 0 评论