摘要: 动态规划问题的小秘籍 1、动态规划的基本思想:将待求解问题分解成若干个子问题,先求解子问题,然后从这些子问题的解得到原问题的解。 2、适用动态规划的条件: 最优子结构 子问题重叠 无后效性 3、分析动态规划必须分析的三个基本要素: 阶段、状态、决策 比如:“黑熊过河” 阶段:石墩 状态:dp[i]: 阅读全文
posted @ 2024-01-25 20:16 RTER 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 排序 1.快速排序 #include<bits/stdc++.h> using namespace std; int n; int a[100001]; void qsort(int l, int r) { if(l>=r)return; int i=l,j=r,x=a[l]; while(i<j) 阅读全文
posted @ 2024-01-25 20:14 RTER 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 二叉树的遍历 前序遍历 #include<bits/stdc++.h> using namespace std; int n; struct s { int l,r,d; }a[10005]; void f(int t)//前序 { if(t==0)return; cout<<t<<' '; f(a 阅读全文
posted @ 2024-01-25 20:09 RTER 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 云课堂笔记(9级) 压行工具 数学用具 A+B的114514种用法 chatGPT 阅读全文
posted @ 2024-01-25 20:08 RTER 阅读(1) 评论(0) 推荐(0) 编辑