会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
青林
我们永远在一起
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
2022年2月24日
拓扑排序
摘要: 1 /**\ 2 拓扑排序:每次找到入度为0的点删掉 3 判断一个有向图中是否有环,无环的图都能进行拓扑排序 4 \**/ 5 #include <bits/stdc++.h> 6 7 using namespace std; 8 9 const int N = 1e5 + 10; 10 11 in
阅读全文
posted @ 2022-02-24 13:53 std&ice
阅读(63)
评论(0)
推荐(0)
2022年2月23日
codeforces-D. Make Them Equal (1600)
摘要: 1 /**\ 2 https://codeforces.com/problemset/problem/1633/D 3 注意到b[i]的范围最大是 1000 ,从1-1000 变化最多大约在13次左右 4 13n复杂度不高,直接预处理每个数从1-1000变化花费 5 然后经典01背包 6 \**/
阅读全文
posted @ 2022-02-23 16:23 std&ice
阅读(93)
评论(0)
推荐(0)
2022年2月19日
重构二叉树
摘要: 根据后序中序重构二叉树,并输出层次遍历模板 1 /**\ 2 input: 3 7 4 2 3 1 5 7 6 4 5 1 2 3 4 5 6 7 6 7 output: 8 4 1 6 3 5 7 2 9 \**/ 10 #include <bits/stdc++.h> 11 12 using n
阅读全文
posted @ 2022-02-19 10:09 std&ice
阅读(101)
评论(0)
推荐(0)
2022年2月18日
二叉树模板合集(前中后层序遍历 中后序->前序 前中序->后序)
摘要: 给出一颗二叉树,n个节点,然后n行,每行3个数字,表示父节点,左儿子,右儿子 遍历模板: 传送门 1 /**\ 2 二叉树的前中后序遍历 3 前序:根左右 4 中序:左根右 5 后序:左右根 6 7 input: 8 6 9 1 2 3 10 2 4 5 11 3 6 -1 12 4 -1 -1 1
阅读全文
posted @ 2022-02-18 19:53 std&ice
阅读(112)
评论(0)
推荐(0)
set常用操作
摘要: 1 /**\ 2 set常用操作: 3 4 set<int> q 默认升序,可创建set数组: set<int> q[10] 5 6 set<int,greater<int> > q 降序排列 7 8 q.find(x) 查找x,返回x的迭代器,若x不存在,返回q.end() 9 10 q.inse
阅读全文
posted @ 2022-02-18 16:22 std&ice
阅读(84)
评论(0)
推荐(0)
C++ 取整函数
摘要: 1 #include <bits/stdc++.h> 2 3 using namespace std; 4 5 const int N = 110; 6 7 signed main() 8 { 9 cout << ceil(1.0 * 9 / 2) << endl; //向上取整 10 cout <
阅读全文
posted @ 2022-02-18 16:03 std&ice
阅读(264)
评论(0)
推荐(0)
2022年2月16日
2.16 codeforce ABC
摘要: 传送门 A: 1 /**\ 2 思路:遍历最后一位即可 因为7个数一个循环,最后一位数必定出现7的倍数 3 \**/ 4 #include <bits/stdc++.h> 5 6 using namespace std; 7 8 signed main() 9 { 10 int _; 11 cin
阅读全文
posted @ 2022-02-16 22:43 std&ice
阅读(80)
评论(0)
推荐(0)
P4913 二叉树深度
摘要: 1 #include <bits/stdc++.h> 2 3 using namespace std; 4 5 const int N = 1e6 + 10; 6 7 int ok = 0; 8 9 int n; 10 struct node 11 { 12 int l, r; 13 } t[N];
阅读全文
posted @ 2022-02-16 16:25 std&ice
阅读(81)
评论(0)
推荐(0)
P4715 淘汰赛
摘要: 一道水题,直接线段树水过去。 1 #include <bits/stdc++.h> 2 3 using namespace std; 4 5 const int N = 100010; 6 int n, a[N]; 7 8 struct node 9 { 10 int l, r, num, id;
阅读全文
posted @ 2022-02-16 16:01 std&ice
阅读(88)
评论(0)
推荐(0)
C++ reverse()函数用法
摘要: 1 #include <bits/stdc++.h> 2 3 using namespace std; 4 5 //方法一 翻转字符串 6 void method1() 7 { 8 string s = "i love acm"; 9 reverse(s.begin(), s.end()); 10
阅读全文
posted @ 2022-02-16 14:09 std&ice
阅读(1594)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
公告