摘要: 前缀和不支持修改,如果修改后面数据都要重算,最坏o(n) #include<iostream> using namespace std; const int N=100010; int a[N];int tr[N];int n,m; int lowbit(int x){ return x&-x; } 阅读全文
posted @ 2024-03-25 21:03 敲代码的6 阅读(3) 评论(0) 推荐(0)
摘要: struct m{ int i,j,k; bool operator< (const m & t){ if(i!=t.i) return i<t.i; if(j!=t.j) return j<t.j; return k<t.k; } }m[N]; //进行结构体的比较时,重载运算符规定好规则,然后用 阅读全文
posted @ 2024-03-03 20:07 敲代码的6 阅读(6) 评论(0) 推荐(0)
摘要: 递推就是根据前面的状态推导出后面的状态 费解的开关 位运算:::判断第op种方案中的第k位数字是否是1? op右移k位与1与运算 (op>>k&1) 把字符串中的0或1取反:与1做异或操作 (x^=1) 题目https://www.acwing.com/problem/content/97/ 文章h 阅读全文
posted @ 2024-03-01 12:00 敲代码的6 阅读(21) 评论(0) 推荐(0)
摘要: 1、对于 scanf printf 和 cin cout 按照10^5来划分使用 递归实现指数型枚举 https://www.acwing.com/problem/content/94/ #include <iostream> #include<cstring> #include<cstdio> # 阅读全文
posted @ 2024-02-28 19:27 敲代码的6 阅读(7) 评论(0) 推荐(0)
摘要: 整数划分 https://www.acwing.com/problem/content/description/902/ #include<iostream> #include<algorithm> using namespace std; const int N=1010,mod=1e9+7; i 阅读全文
posted @ 2024-02-19 11:51 敲代码的6 阅读(4) 评论(0) 推荐(0)
摘要: 898. 数字三角形 https://www.acwing.com/problem/content/900/ #include<iostream> #include<cstring> #include<algorithm> using namespace std; const int N=510,I 阅读全文
posted @ 2024-02-06 11:25 敲代码的6 阅读(12) 评论(0) 推荐(0)
摘要: 01背包 二维 //二维 #include<iostream> #include<cmath> using namespace std; const int N=1010; int p[N][N]={0}; int v[N];int w[N]; int m,n; int main() { cin>> 阅读全文
posted @ 2024-01-31 23:31 敲代码的6 阅读(20) 评论(0) 推荐(0)
摘要: 7-3 小字辈 分数 25 全屏浏览题目 切换布局 作者 陈越 单位 浙江大学 本题给定一个庞大家族的家谱,要请你给出最小一辈的名单。 输入格式: 输入在第一行给出家族人口总数 N(不超过 100 000 的正整数) —— 简单起见,我们把家族成员从 1 到 N 编号。随后第二行给出 N 个编号,其 阅读全文
posted @ 2024-01-28 20:08 敲代码的6 阅读(69) 评论(0) 推荐(0)
摘要: 7-2 这是二叉搜索树吗? 分数 25 全屏浏览题目 切换布局 作者 陈越 单位 浙江大学 一棵二叉搜索树可被递归地定义为具有下列性质的二叉树:对于任一结点, 其左子树中所有结点的键值小于该结点的键值; 其右子树中所有结点的键值大于等于该结点的键值; 其左右子树都是二叉搜索树。 所谓二叉搜索树的“镜 阅读全文
posted @ 2024-01-28 11:33 敲代码的6 阅读(20) 评论(0) 推荐(0)
摘要: #include<iostream> #include<algorithm> #include<string> #include<stack> #include<stdlib.h> using namespace std; stack<double>st; int main() { string s 阅读全文
posted @ 2024-01-22 20:03 敲代码的6 阅读(17) 评论(0) 推荐(0)