摘要: 我自己是通过深度优先搜索实现的,虽然效率不高但是思路很简单 class Solution { public: vector<vector<int>> combine(int n, int k) { vector<vector<int> > v; DFS(1,v,n,k); return v; } p 阅读全文
posted @ 2020-09-08 19:25 是水泵呢 阅读(104) 评论(0) 推荐(0) 编辑
摘要: #include<cstdio> #include<queue> #include<vector> using namespace std; const int N = 110; struct node{ int deep; vector<int> child; }Node[N];//1..N-1 阅读全文
posted @ 2020-09-08 18:56 是水泵呢 阅读(54) 评论(0) 推荐(0) 编辑
摘要: #include<cstdio> #include<vector> #include<math.h> #include<queue> using namespace std; const int N = 100010; struct node{ bool isretailer=true; vecto 阅读全文
posted @ 2020-09-08 18:29 是水泵呢 阅读(83) 评论(0) 推荐(0) 编辑
摘要: 本题的重点是利用层序遍历维持树每个结点的深度数据的更新,这是层序遍历的一个重要应用。 注意:计算叶子节点的次方时用#include<math.h>下的pow函数,不然最后一个样例会超时 #include<cstdio> #include<vector> #include<queue> #includ 阅读全文
posted @ 2020-09-08 17:09 是水泵呢 阅读(93) 评论(0) 推荐(0) 编辑