当前位置:网站首页>2034: [Blue Bridge Cup 2022 preliminary] pruning shrubs
2034: [Blue Bridge Cup 2022 preliminary] pruning shrubs
2022-07-27 08:41:00 【Madness makes freedom】
2034: [ Blue Bridge Cup 2022 Preliminaries ] Pruning shrubs
Memory limit :256 MB The time limit :1 S Standard input and output
Topic type : Tradition Evaluation method : Text comparison Uploaded by : External import
Submit :227 adopt :158
Title Description
Alice has to finish a job of pruning shrubs .
Yes N The shrubs are arranged neatly from left to right .
Alice trims a bush at the party every day , Make the height of the Bush 0 centimeter .
Alice's order of pruning shrubs is to start with the shrub on the far left , Trim a shrub to the right every day .
When the rightmost Bush is trimmed , She'll turn around , Start pruning the shrubs to the left the next day .
Until you trim the leftmost shrub and turn the direction again . And then go back and forth .
Shrubs grow every day from morning to evening 1 centimeter , And the rest of the time will not grow tall .
On the first morning , The height of all shrubs is 0 centimeter . Alice wanted to know how high each Bush was at the top .
Input format
A positive integer N , The meaning is as stated in the title .
30% Test data for :1<N≤10;
100% Test data for :1<N≤10000.
Output format
Output N That's ok , One integer per row , The first i The line represents the first... From left to right i How high can a tree grow .
sample input Copy
3sample output Copy
4
2
4
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
for(int i=1;i<=n;++i)
{
int temp=max(abs(i-n),abs(i-1));
cout << 2*temp << endl;
}
return 0;
}
边栏推荐
- openGauss之TryMe初体验
- Massive data Xiao Feng: jointly build and govern opengauss root community and share a thriving new ecosystem
- Flask's operations on model classes
- Realize SKU management in the background
- Hundreds of people participated. What are these people talking about in the opengauss open source community?
- redis 网络IO
- [penetration test tool sharing] [dnslog server building guidance]
- Forced login, seven cattle cloud upload pictures
- Bandwidth and currency
- Realize SPU management in the background
猜你喜欢

带宽 与 货币

永久设置source的方法

Day4 --- flask blueprint and rest ful

Background image related applications - full, adaptive

面试官:什么是脚手架?为什么需要脚手架?常用的脚手架有哪些?

网络IO总结文

Functions and arrow functions

众昂矿业:新能源行业快速发展,氟化工产品势头强劲

Forced login, seven cattle cloud upload pictures

On Valentine's day, I drew an object with characters!
随机推荐
Flink1.15 source code reading Flink clients client execution process (reading is boring)
4274. 后缀表达式
Help send some recruitment. If you are interested, you can have a look
3428. 放苹果
3311. 最长算术
CMD command and NPM command
Set set
4277. 区块反转
MySQL Express
Supervisor 安装与使用
[uni app advanced practice] take you hand-in-hand to learn the development of a purely practical complex project 1/100
Luogu Taotao picks apples
STM32 small bug summary
3311. Longest arithmetic
Realization of specification management and specification option management functions
Eval and assert execute one sentence Trojan horse
UVM Introduction Experiment 1
693. Travel sequencing
好吃难吃饱七分为宜;好喝难喝醉三分为佳
First experience of tryme in opengauss