摘要: 题目: 求最长的重量上升且iq下降的子序列分析: 其实就是最长上升子序列的变形,其实很简单,先按重量按照由小到大进行排序, 然后就是LIS的事,打印路径的话,用数组path[]记录后面的位置,利用 递归实现打印(具体参考算法导论)#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;#define X 1005int dp[X],path[X];struct node{ int iq,w,id; //记录iq,重量 阅读全文
posted @ 2012-03-09 16:40 yejinru 阅读(236) 评论(0) 推荐(0) 编辑