当前位置:网站首页>2034: [蓝桥杯2022初赛] 修剪灌木
2034: [蓝桥杯2022初赛] 修剪灌木
2022-07-17 22:49:00 【疯疯癫癫才自由】
2034: [蓝桥杯2022初赛] 修剪灌木
内存限制:256 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:外部导入
提交:227 通过:158
题目描述
爱丽丝要完成一项修剪灌木的工作。
有 N 棵灌木整齐的从左到右排成一排。
爱丽丝在每天傍晚会修剪一棵灌木,让灌木的高度变为 0 厘米。
爱丽丝修剪灌木的顺序是从最左侧的灌木开始,每天向右修剪一棵灌木。
当修剪了最右侧的灌木后,她会调转方向,下一天开始向左修剪灌木。
直到修剪了最左的灌木后再次调转方向。然后如此循环往复。
灌木每天从早上到傍晚会长高 1 厘米,而其余时间不会长高。
在第一天的早晨,所有灌木的高度都是 0 厘米。爱丽丝想知道每棵灌木最高长到多高。
输入格式
一个正整数N ,含义如题面所述。
30%的测试数据:1<N≤10;
100%的测试数据:1<N≤10000。
输出格式
输出 N 行,每行一个整数,第 i 行表示从左到右第 i 棵树最高能长到多高。
输入样例 复制
3输出样例 复制
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;
}
边栏推荐
猜你喜欢

Re understanding of Fourier transform
![2021.07.13 [station B] collapsed like this](/img/af/d7d6ae059b4bc2d76c6ea0edb64c82.png)
2021.07.13 [station B] collapsed like this

ZABBIX realizes the monitoring of redis

High performance pxie data preprocessing board based on kinex ultrascale series FPGA (ku060 +fmc sub card interface)

csrf防护机制

How to read and save point cloud data with numpy

How to bind process threads to CPU cores

44. Use orienmask for instance segmentation target detection, MNN deployment and ncnn deployment

Single channel 6Gsps 12 bit AD acquisition and single channel 6Gsps 16 bit Da (ad9176) output sub card based on vita57.1 standard

Top domestic experts gathered in Guangzhou to discuss the safety application of health care data
随机推荐
GYM103660E.Disjoint Path On Tree 树上计数
009 execution sequence of SQL statement of interview questions
[LeetCode]-动态规划-4
TDesign compositionapi refactoring path
微信小程序7-云存储
天勤第九章课后习题代码
kube-proxy & Service & Endpoint
Knapsack problem
UVA340 Master-Mind Hints
国内顶尖专家集聚广州,探讨健康医疗数据安全应用
csrf防护机制
一次函数 T1744 963字符写法
Behind the high salary of programmers' operation and maintenance
Wechat applet 8 cloud function
Read the paper: temporary graph networks for deep learning on dynamic graphs
Several points to be analyzed in the domestic fpga/dsp/zynq scheme
Leetcode 1275. 找出井字棋的获胜者
C - matrix chain multiplexing (Application of stack)
程序员 运维那些高薪的背后
Internship is a barrier to enter the society