摘要:
题目链接:http://poj.org/problem?id=2502#include #include #include #include #include #include using namespace std;const int MAXN=300;const double INF=99999... 阅读全文
posted @ 2014-02-13 23:18
neverchanje
阅读(143)
评论(0)
推荐(0)
摘要:
题目链接:http://poj.org/problem?id=3624//典型01背包问题//状态转移方程dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+d[i]) //实现:逆序 #include#include#include#includeusing namespace std;const int maxn=20000;const int maxc=20000;int n,m; //n为珠宝数量,m为背包容量int w[maxn],d[maxn]; //分别为每个珠宝的重量和诱人度 int dp[maxc];int bp(){ memset(dp,... 阅读全文
posted @ 2014-02-13 22:48
neverchanje
阅读(167)
评论(0)
推荐(0)
摘要:
poj 1887 Testing the CATCHER题目链接:http://poj.org/problem?id=1887dp[i]表示以v[i]结尾的数列dp[i]=max(dp[k]+1) (v[k]>v[i])本题要注意输出//其实最长递减序列可以转换成最长上升序列//因为其下标是递增的 #include#include#define INF 10000using namespace std;const int maxn=INF;int n;int v[maxn];int MDS(){ int Max; int dp[maxn]; Max=0... 阅读全文
posted @ 2014-02-13 16:41
neverchanje
阅读(439)
评论(0)
推荐(0)

浙公网安备 33010602011771号