当前位置:网站首页>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;
}
边栏推荐
- Grafana 9.0 is officially released! It's the strongest!
- Mathematics in machine learning -- common probability distribution (XIII): Logistic Distribution
- Epoll () whether it involves wait queue analysis
- Recursive way
- Top command details
- Collection of penetration test information -- use with nmap and other tools
- STM32+HC05串口蓝牙设计简易的蓝牙音箱
- POJ 2208 已知边四面体六个长度,计算体积
- 30 minutes to understand PCA principal component analysis
- C language college laboratory reservation registration system
猜你喜欢
随机推荐
Cobra 快速入门 - 专为命令行程序而生
监控界的最强王者,没有之一!
UFIDA OA vulnerability learning - ncfindweb directory traversal vulnerability
Afnetworking framework_ Upload file or image server
Grafana 9.0 is officially released! It's the strongest!
C language college laboratory reservation registration system
JDBC驱动器、C3P0、Druid和JDBCTemplate相关依赖jar包
SQL injection - access injection, access offset injection
Unity资源顺序加载的一个方法
复现Thinkphp 2.x 任意代码执行漏洞
Crawling data encounters single point login problem
CRMEB 商城系统如何助力营销?
图片缩放中心
RedisSystemException:WRONGTYPE Operation against a key holding the wrong kind of value
Coco2017 dataset usage (brief introduction)
Recommend easy-to-use backstage management scaffolding, everyone open source
With the implementation of MapReduce job de emphasis, a variety of output folders
首先看K一个难看的数字
爬虫玩得好,牢饭吃到饱?这3条底线千万不能碰!
atcoder它A Mountaineer