摘要: 洛谷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( 阅读全文
posted @ 2024-05-24 17:21 若把你比作歌 阅读(10) 评论(0) 推荐(0)
摘要: 洛谷P1364 #include<bits/stdc++.h> using namespace std; struct node{ int value, left, right, p; node(int v, int l, int r): left(l), right(r), value(v){} 阅读全文
posted @ 2024-05-24 17:04 若把你比作歌 阅读(20) 评论(0) 推荐(0)
摘要: 洛谷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 阅读全文
posted @ 2024-05-24 16:34 若把你比作歌 阅读(106) 评论(0) 推荐(0)
摘要: 洛谷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 阅读全文
posted @ 2024-05-24 01:27 若把你比作歌 阅读(17) 评论(0) 推荐(0)