贪心
MaywrILoi
这个作者很懒,什么都没留下…
展开
-
Codevs1615数据备份
http://codevs.cn/problem/1615/ 思路: 方案一:O(n*k)的DP…只能得部分分。 首先我们知道,只选择相邻的点构成线段,答案一定不会变差。 因为若选择跨点连线,我们必然可以用其中相邻点构成的连线代替,且使得权值更小。 那么我们就只考虑相邻点构成的线段如何选取。 我们设dp[i][j][1/0]前i条线段选了j条线段是否选择当前线段(包括在j内) 每次用原创 2017-11-07 21:30:44 · 317 阅读 · 0 评论 -
HDU 5500 Reorder the Books
http://acm.hdu.edu.cn/showproblem.php?pid=5500 代码 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> using namespace std; int t,n,ans,maxn,pos; int num[1000010];原创 2017-11-08 20:34:19 · 264 阅读 · 0 评论 -
洛谷 P3093 牛奶调度Milk Scheduling
https://www.luogu.org/problemnew/show/3093 思路 详见代码注释 代码 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> #include<queue> using namespace std; int n,maxn,now,an原创 2017-11-08 20:36:04 · 467 阅读 · 0 评论