摘要: 给出一颗二叉树,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 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(61) 评论(0) 推荐(0) 编辑
摘要: 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 阅读(227) 评论(0) 推荐(0) 编辑