摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=3466思路:贪心对当前能取的,q-p较小的优先考虑#include #include #include #include #include #include using namespace std;#define maxn 500005int dp[maxn];struct thing{ int p,q,v;}t[510];bool cmp(thing a,thing b){ return (a.q-a.p)=t[i].p;j--) if(j>=t[i].q) ... 阅读全文
posted @ 2013-07-29 15:53 over_flow 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=2639思路:01背包 第K优解#include #include #include #include #include #include using namespace std;int N,V,K;int f[1010][35];int A[35],B[35];int v[110],w[110];int main(){ int t; scanf("%d",&t); while(t--) { scanf("%d%d%d",&N,&V,& 阅读全文
posted @ 2013-07-29 15:21 over_flow 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=2184负体积的01背包,将原点偏移一下,空间变大了#include #include #include #include #include #include #include #define maxn 200010using namespace std;int s[110],f[110];int dp[maxn];const int miao=100000;int main(){ int n; scanf("%d",&n); int sum=0; for(int i=1;i0) for(i... 阅读全文
posted @ 2013-07-29 14:50 over_flow 阅读(156) 评论(0) 推荐(0) 编辑