随笔分类 -  从零开始的机试准备

这是一个C++/Python分类,主要内容是Acwing算法基础课、力扣以及其他网站的刷题笔记。
摘要:DFS深度优先遍历 回溯、剪枝、对应一条搜索树 全排列问题 #include <iostream> #include <algorithm> using namespace std ; const int N = 10 ; int n; int path[N] ; // 存方案的 bool st[N 阅读全文
posted @ 2023-05-07 15:41 尊滴菜 阅读(17) 评论(0) 推荐(0) 编辑
摘要:线性DP 数字三角形 给定一个如下图所示的数字三角形,从顶部出发,在每一结点可以选择移动至其左下方的结点或移动至其右下方的结点,一直走到底层,要求找出一条路径,使路径上的数字的和最大。 #include <iostream> #include <algorithm> using namespace 阅读全文
posted @ 2023-05-07 11:28 尊滴菜 阅读(8) 评论(0) 推荐(0) 编辑
摘要:第一题 水题,没啥好说的 #include <iostream> #include <cmath> using namespace std; const int N = 1e6 ; double a[N] ; int main(){ int n ; cin>>n ; double sum = 0; 阅读全文
posted @ 2023-05-02 10:39 尊滴菜 阅读(16) 评论(0) 推荐(0) 编辑
摘要:第一题 不给提示可能还真想不到,按照提示写就行 #include <cmath> #include <iostream> #include <iomanip> using namespace std; const int N = 1e6+10 ; int n,m ; int a[N],b[N],c[ 阅读全文
posted @ 2023-05-02 00:57 尊滴菜 阅读(14) 评论(0) 推荐(0) 编辑
摘要:第一题(太水了) #include <cmath> #include <iostream> #include <iomanip> using namespace std; const int N = 1e6+10 ; int n; double lixi, w, sum = 0; int main( 阅读全文
posted @ 2023-05-01 23:50 尊滴菜 阅读(18) 评论(0) 推荐(0) 编辑
摘要:第一题 直接满分了: #include <iostream> using namespace std ; const int N = 1e6 ; int n,a,b ; int panduan(int x1,int y1,int x2, int y2, int a,int b) { int c,k 阅读全文
posted @ 2023-05-01 22:18 尊滴菜 阅读(57) 评论(0) 推荐(0) 编辑
摘要:背包问题 (1)0 1 背包 —— 每件物品最多使用一次 求解将哪些物品装入背包,可使这些物品的总体积不超过背包容量,且总价值最大。输出最大价值。 #include <iostream> #include <algorithm> using namespace std; const int N = 阅读全文
posted @ 2023-04-30 16:22 尊滴菜 阅读(18) 评论(0) 推荐(0) 编辑
摘要:trie树 主要作用:快速存储、查找字符串 单词的结尾要进行标记,表示“到达该节点,存在一个单词” #include <iostream> using namespace std; const int N = 1e6+10; int son[N][26] ; //字母最多26个 int cnt[N] 阅读全文
posted @ 2023-04-30 00:45 尊滴菜 阅读(13) 评论(0) 推荐(0) 编辑
摘要:单链表 #include <iostream> using namespace std; const int N = 1e6+10; int shuzhi[N], next_position[N]; int head, idx ; //头结点下标、当前的下标 void init() { head = 阅读全文
posted @ 2023-03-25 23:02 尊滴菜 阅读(12) 评论(0) 推荐(0) 编辑
摘要:双指针算法 O(n) 采用双指针算法的前提是具有单调性 题目:提取单词 #include <iostream> #include <string.h> using namespace std ; const int N = 1e3+10; int main(){ char str[1000]; ge 阅读全文
posted @ 2023-03-24 23:11 尊滴菜 阅读(14) 评论(0) 推荐(0) 编辑
摘要:高精度加法 (常规只能到10^6次方) 思想:1、大整数存储:每一位存入数组,个位存在前,高位存在后(和常规表示是反的); 2、模拟手算加法的步骤,进位 #include <iostream> #include <vector> using namespace std; const int n = 阅读全文
posted @ 2023-03-24 02:31 尊滴菜 阅读(18) 评论(0) 推荐(0) 编辑
摘要:介绍了《算法基础课》中基础算法(1)的相关内容和代码模板 阅读全文
posted @ 2023-03-05 23:16 尊滴菜 阅读(23) 评论(0) 推荐(0) 编辑
摘要:一些打算 阅读全文
posted @ 2023-03-05 20:01 尊滴菜 阅读(39) 评论(0) 推荐(0) 编辑

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