Files
python/TangDou/XiTi/1406_5.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

20 lines
668 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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;
}