You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
668 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include <bits/stdc++.h>
using namespace std;
int main() {
//输入+输出重定向
//freopen("../x.in", "r", stdin);
//freopen("../x.out", "w", stdout);
/**
本题难度主要在于建树我们发现由于得到的序列长度是2的幂所以得到的树是一棵完全二叉树
我们按照层数对每个节点逐一进行编号,可以发现,一个节点(编号为 i的左儿子编号为 ; i << 1 右儿子编号为: (1 << i) | 1
可以直接生成出要求的树,进行后序遍历时加以判断即可。
*/
//关闭文件
//fclose(stdin);
//fclose(stdout);
return 0;
}