随笔分类 - 贪心
摘要:题目链接:http://codeforces.com/problemset/problem/93/B B. End of Exams time limit per test 1 second time limit per test memory limit per test 256 megabyte
阅读全文
摘要:题目链接:http://poj.org/problem?id=3253 Fence Repair Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 61005 Accepted: 20119 Description Farmer J
阅读全文
摘要:题目大意:输入n,代表有一个长度为n的字符串。 起初,T是一个空串,随后反复进行下列任意操作: 从S 的头部删除一个字符,加入到T的尾部‘ 从S的尾部删除一个字符,加入到T的尾部 目的是构造字典序尽可能小的字符串T 限制条件: 1<=n<=2000,每个字符串只包含大写字母 思路:这题主要要知道当前
阅读全文
摘要:区间调度问题 有n项工作,每项工作分别在si时间开始,ti结束。对于每项工作你都可以选择参加与否。但是如果参加了就一定要全程参与。 此外,参加工作的时间段不能重叠。你的目标是参与尽可能多的工作? 思路:按照每项工作的结束时间从小到大排序,每次选择最小的,就是最优解。。。为什么呢? 因为每次选择一个结
阅读全文
摘要:有1、5、10、50、100、500元的硬币各c0、c1、c2、c3、c4、c5个,现在要用这些硬币来支付sum元,最少要多少枚硬币? 假定本题至少存在一种方案 输入 3 2 1 3 0 2 620 输出 6 看代码
阅读全文
摘要:题目链接:http://codeforces.com/problemset/problem/589/F A gourmet came into the banquet hall, where the cooks suggested n dishes for guests. The gourmet k
阅读全文
摘要:题目链接:https://vjudge.net/contest/241341#problem/G Indonesia, as well as some neighboring Southeast Asian countries and some other East Asian countries,
阅读全文
摘要:题目链接:https://vjudge.net/contest/239445#problem/E E - Problem Statement You are given nn strings str1,str2,…,strnstr1,str2,…,strn , each consisting of
阅读全文
摘要:题目链接:https://vjudge.net/contest/237394#problem/B There are n pictures delivered for the new exhibition. The i-th painting has beauty ai. We know that
阅读全文
摘要:感觉很多贪心的题目只要想到怎么贪心就很快能解决,但是没有想到的话代码量就会很大,而且很容易出错,所有贪心还是要多做题目,掌握各种贪心的题目 题目链接:https://vjudge.net/contest/231313#problem/D A factory produces products pac
阅读全文
摘要:关于set的学习:http://www.360doc.com/content/17/0526/22/10408243_657567440.shtml 题目链接:https://vjudge.net/contest/236677#problem/D 题目大意:有n个桌子,q条指令,每个桌子有多少椅子按
阅读全文

浙公网安备 33010602011771号