上一页 1 ··· 3 4 5 6 7 8 9 下一页
摘要: 1.dfs n皇后问题 #include <iostream> using namespace std; const int N = 20; int n; char g[N][N]; int col[N] , dg[N] , udg[N];//列,正对角线,斜对角线 void dfs(int u){ 阅读全文
posted @ 2021-12-08 08:33 乐池 阅读(66) 评论(0) 推荐(0)
摘要: #include <iostream> #include <cstring> using namespace std; const int N = 100003; int h[N] , e[N] , ne[N] , idx;//h是数组头,e是存的插的链表的值,ne是其下一个的idx void in 阅读全文
posted @ 2021-12-04 11:17 乐池 阅读(59) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2021-11-27 19:19 乐池 阅读(239) 评论(0) 推荐(0)
摘要: 1.Trie树 , 高速地存储和查找字符串集合的数据结构 #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N = 1e5+10; int son[N][26] , c 阅读全文
posted @ 2021-11-21 17:12 乐池 阅读(57) 评论(0) 推荐(0)
摘要: 1.https://www.acwing.com/problem/content/431/ 主要是重载小于号和自己写比较函数两种方法,但是之前不会 现在会了就好 ####重载小于号 1 #include <iostream> 2 #include <algorithm> 3 #include <cs 阅读全文
posted @ 2021-11-20 22:43 乐池 阅读(81) 评论(0) 推荐(0)
摘要: 1.链表 1)单链表:邻接表 数组实现单链表: #include <iostream> #include <cstring> #include <algorithm> #include <vector> using namespace std; const int N = 100010; //e[N 阅读全文
posted @ 2021-11-17 21:12 乐池 阅读(64) 评论(0) 推荐(0)
摘要: 1.双指针 2.位运算 3.离散化 1)去除重复元素 vector<int>all; sort(all.begin() , all.end());//排序 all.erase(unique(all.begin() , all.end()) , all.end());//删除末尾的重复元素 2)代码 阅读全文
posted @ 2021-11-17 00:16 乐池 阅读(57) 评论(0) 推荐(0)
摘要: 1.快速排序:基本思想是分治,时间复杂度nlog(n) 1)确定分界点 2)调整区间 3)递归处理左右两段 #include <iostream> #include <cstdio> using namespace std; const int N = 100010; int a[N]; void 阅读全文
posted @ 2021-11-13 12:00 乐池 阅读(48) 评论(0) 推荐(0)
摘要: 1.位运算 & 与 AND | 或 OR ~ 非 NOT ^ 异或 XOR >> 右移 << 左移 求x的第k位数字 x >> k & 1 , 从后往前数,最末一位是0 lowbit(x) = x & -x,-x是(~x+1) ; 返回x的最后一位1 , 即110110,则返回10 ; 101000 阅读全文
posted @ 2021-11-11 19:36 乐池 阅读(92) 评论(0) 推荐(0)
摘要: 1.vector 头文件#include <vector> 常见的方法有vector.clear() ; vector.size() ; vector.empty(); 遍历输出vector: #include <iostream> #include <vector> using namespace 阅读全文
posted @ 2021-11-10 18:20 乐池 阅读(88) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 下一页