博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
10131 - Is Bigger Smarter?
阅读量:4582 次
发布时间:2019-06-09

本文共 1010 字,大约阅读时间需要 3 分钟。

//题目信息
//本题主要是用动态规划。参考寂静山林的博客,写的非常详细(),这里只是做个个人随笔记录 //2012/2/28 //accepted // #include
#include
#include
using namespace std; #define MAXNUM 1000 void backtrack(int index); class elephant {
public: int index; int weight; int iq; bool operator < (const elephant &other) const {
if(weight!=other.weight) return weight
other.iq; } }; elephant elephants[MAXNUM]; int length[MAXNUM]; int parent[MAXNUM]; int main() {
int index=0,weight,iq; int i,j; while(cin>>elephants[index].weight>>elephants[index].iq) {
elephants[index].index=index; index++; } sort(elephants,elephants+index); for(i=0;i
iq) if(length[i] <= length[j]) {
length[i]=length[j]+1; parent[i]=j; } } if(maxLength

动态规划,回溯法输出解,以及父节点记录的方法。。

转载于:https://www.cnblogs.com/redlight/archive/2012/02/28/2371907.html

你可能感兴趣的文章
sendmessage和postmessage的区别
查看>>
【求助】NdisSend,自定义数据包发送失败?
查看>>
linux的相关问题
查看>>
codeforces 340D Bubble Sort Graph(dp,LIS)
查看>>
Oracle生产问题
查看>>
iOS设计模式 - 生成器
查看>>
关于fpga优化的set input delay 和 set output delay
查看>>
RabbitMQ提升消息可靠性的方法
查看>>
import标签的解析
查看>>
高程5.6 基本包装类型
查看>>
HDU-1017 A Mathematical Curiosity
查看>>
Squid系统服务脚本
查看>>
第二阶段冲刺03
查看>>
mysql 查看表结构简单命令
查看>>
64为系统配置PLSQL
查看>>
动态Linq(结合反射)
查看>>
注册表读写操作的VC实现[转]
查看>>
ubuntu修改默认运行级别
查看>>
【Leetcode】【Easy】Binary Tree Level Order Traversal
查看>>
015 内边距的问题
查看>>