当前位置:网站首页>AcWing 3537. Tree lookup complete binary tree
AcWing 3537. Tree lookup complete binary tree
2022-07-06 18:41:00 【Alkali!】
Title Description
https://www.acwing.com/problem/content/3540/
Output the... Of the complete binary tree stored in the array k k k All values of the row
Code
#include<iostream>
#include<cmath>
using namespace std;
const int N=1010;
int tree[N];
int n;
int k;
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%d",&tree[i]);
scanf("%d",&k);
if((1<<(k-1))>n) // If the given number of rows K> Maximum number of rows , Then the output must be empty
{
printf("EMPTY");
return 0;
} // The maximum value is exquisite
for(int i=(1<<(k-1));i<min(n+1,(1<<k));i++) // Output the line
printf("%d ",tree[i]);
return 0;
}
边栏推荐
- Example of implementing web server with stm32+enc28j60+uip protocol stack
- 【剑指 Offer】 60. n个骰子的点数
- Nuc11 cheetah Canyon setting U disk startup
- Grafana 9.0 is officially released! It's the strongest!
- None of the strongest kings in the monitoring industry!
- Cobra quick start - designed for command line programs
- STM32+ENC28J60+UIP协议栈实现WEB服务器示例
- UDP protocol: simple because of good nature, it is inevitable to encounter "city can play"
- Distiller les connaissances du modèle interactif! L'Université de technologie de Chine & meituan propose Virt, qui a à la fois l'efficacité du modèle à deux tours et la performance du modèle interacti
- epoll()无论涉及wait队列分析
猜你喜欢

Splay

Collection of penetration test information -- use with nmap and other tools

There is a sound prompt when inserting a USB flash disk under win10 system, but the drive letter is not displayed

基于ppg和fft神经网络的光学血压估计【翻译】

Recommend easy-to-use backstage management scaffolding, everyone open source

Coco2017 dataset usage (brief introduction)

Virtual machine VirtualBox and vagrant installation

Easy to use PDF to SVG program

Self supervised heterogeneous graph neural network with CO comparative learning

【中山大学】考研初试复试资料分享
随机推荐
Test 1234
二叉搜索树
44所高校入选!分布式智能计算项目名单公示
STM32+MFRC522完成IC卡号读取、密码修改、数据读写
Using block to realize the traditional values between two pages
测试行业的小伙伴,有问题可以找我哈。菜鸟一枚~
上海部分招工市场对新冠阳性康复者拒绝招录
徐翔妻子应莹回应“股评”:自己写的!
Wchars, coding, standards and portability - wchars, encodings, standards and portability
Jerry is the custom background specified by the currently used dial enable [chapter]
2022 Summer Project Training (III)
Transport layer congestion control - slow start and congestion avoidance, fast retransmission, fast recovery
Hongke shares | plate by plate ar application in Beijing Winter Olympics
Penetration test information collection - WAF identification
None of the strongest kings in the monitoring industry!
First, look at K, an ugly number
A method of sequentially loading Unity Resources
Echart simple component packaging
Tree-LSTM的一些理解以及DGL代码实现
Use cpolar to build a business website (1)