weinan030416

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

随笔分类 -  动态规划

后面的结果要根据前面的结果推出来
dp
摘要:121. 买卖股票的最佳时机 - 力扣(LeetCode) class Solution { public: int maxProfit(vector<int>& prices) { int max=0; for(int i=0;i<prices.size();i++) for(int j=i;j< 阅读全文

posted @ 2023-02-13 13:36 楠030416 阅读(23) 评论(0) 推荐(0) 编辑

线段树查询i到j最长增加子串和序列
摘要:基础篇 最长增加子数组 - 楠030416 - 博客园 (cnblogs.com) 增加线段树 子串 #include<bits/stdc++.h> using namespace std; //最长连续增加子串 int a[100],dp[100],tree[100]; void build(in 阅读全文

posted @ 2023-02-09 09:34 楠030416 阅读(51) 评论(0) 推荐(0) 编辑

最长增加子数组
摘要:子串 要求一定要挨着 121 2 3 4 3 2 1 4 5 6 7 8 结果 6 #include<bits/stdc++.h> using namespace std; //最长连续增加子串 int a[100],dp[100],maxn=0; int main() { int n; cin>> 阅读全文

posted @ 2023-02-08 23:27 楠030416 阅读(12) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示