博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
北大ACM——3616,Milking Time(DP)
阅读量:4049 次
发布时间:2019-05-25

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

突破口:只要发现DP对象是间歇M,便可发现本质是最大递增子序列。

代码如下:

#include
#include
#include
#include
using namespace std;long long dp[1005];struct mt{ int s,t,e;}m[1005];bool cmp(mt x,mt y){ if(x.t!=y.t) return x.t
>N>>M>>R; for(i=0;i<=M-1;i++) cin>>m[i].s>>m[i].t>>m[i].e; sort(m,m+M,cmp); // for(i=0;i<=M-1;i++) // cout<
<<' '<
<<' '<
<
N) break; if(i==0) ans=dp[i]=m[i].e; else { temp=0; for(j=i-1;j>=0;j--) { if(m[i].s-m[j].t>=R) { if(temp

Tips:DP需确定准对象。

转载地址:http://abdci.baihongyu.com/

你可能感兴趣的文章
【leetcode】Candy(python)
查看>>
【leetcode】Clone Graph(python)
查看>>
【leetcode】Sum Root to leaf Numbers
查看>>
【leetcode】Pascal's Triangle II (python)
查看>>
java自定义容器排序的两种方法
查看>>
如何成为编程高手
查看>>
本科生的编程水平到底有多高
查看>>
AngularJS2中最基本的文件说明
查看>>
从头开始学习jsp(2)——jsp的基本语法
查看>>
使用与或运算完成两个整数的相加
查看>>
备忘:java中的递归
查看>>
DIV/CSS:一个贴在左上角的标签
查看>>
Solr及Spring-Data-Solr入门学习
查看>>
Vue组件
查看>>
python_time模块
查看>>
python_configparser(解析ini)
查看>>
selenium学习资料
查看>>
<转>文档视图指针互获
查看>>
从mysql中 导出/导入表及数据
查看>>
HQL语句大全(转)
查看>>