PAT a1064题解
来源:互联网 发布:最优化第二版课后答案 编辑:程序博客网 时间:2024/06/08 00:05
#include <cstdio>#include <algorithm>using namespace std;const int maxn = 1010;int n, number[maxn], CBT[maxn], index = 0;void inOrder(int root){if(root > n) return;inOrder(root * 2);CBT[root] = number[index++];inOrder(root * 2 + 1);}int main(){scanf("%d", &n);for(int i = 0; i < n; i++){scanf("%d", &number[i]);}sort(number, number + n);inOrder(1);for(int i = 1; i <= n; i++){printf("%d", CBT[i]);if(i < n) printf(" ");}return 0;}
阅读全文
1 0
- PAT a1064题解
- [PAT] A1064
- PAT-A1064
- PAT A1064. Complete Binary Search Tree (30)
- pat-a1064. Complete Binary Search Tree (30)
- PAT 1001-1010 题解
- PAT 1011-1020 题解
- PAT 1021-1030 题解
- PAT 1031-1040 题解
- PAT 1041-1050 题解
- PAT 1051-1060 题解
- PAT(basic level)题解
- PAT乙级题解
- PAT题解目录
- PAT甲级题解目录
- PAT乙级题解目录
- PAT甲级1001题解
- PAT甲级1002题解
- UVA11059MaximumProduct
- chrome.runtime.sendMessage 回调函数参数为undefined
- linux---rhel6.5虚拟机安装及封装
- PAT a1063题解
- 常用 ant组件 地址
- PAT a1064题解
- JUC锁-04之 公平锁(二)
- PAT a1065题解
- PAT a1066题解
- java设计模式---装饰模式篇
- Java ArrayList和LinkedList的区别
- Android事件分发流程
- <划重点的Unity2017>事件系统
- PAT a1067题解