摘要:
洛谷P1087 递归建立树,根据当前树的类型,选择“F”“B”“I” void build(int depth, int start, int end, int root){ if (depth >= n+1) return; int current = root; int flag = check 阅读全文
摘要:
洛谷P1229 计算有多少个节点只有一个子节点。输出pow(2, n) #include<bits/stdc++.h> using namespace std; int main() { string a, b; int ans = 0; cin >> a >> b; int l = a.size( 阅读全文
摘要:
洛谷P5076 #include<bits/stdc++.h> using namespace std; int n, root, cnt, opt, x; struct node{ int value, left, right, size, num; node(int l, int r, int 阅读全文
摘要:
洛谷P1827 输入中序先序序列,输出后序 l1-l2为当前中序遍历序列 l3-l4为当前先序遍历序列 #include<bits/stdc++.h> using namespace std; string a, b; void build(int l1, int l2, int l3, int l 阅读全文
摘要:
这个题思路和洛谷P2440有点像,建议先看P2440这个题,较简单。 二分答案 题目详见洛谷P3853路标设置 思路 建议先看这里,我的另一个博客 这里先贴段代码 bool check(long long length) { int num = 0; int now = 0; for(int i = 阅读全文