当前位置:网站首页>2022信息与未来预备刷题4《New Online Judge 2034: [蓝桥杯2022初赛] 修剪灌木》
2022信息与未来预备刷题4《New Online Judge 2034: [蓝桥杯2022初赛] 修剪灌木》
2022-04-21 10:00:00 【joe_zxq的编程世界】
P2034 - [蓝桥杯2022初赛] 修剪灌木 - New Online Judge
http://oj.ecustacm.cn/problem.php?id=2034
内存限制:256 MB时间限制:1 S标准输入输出
题目类型:传统评测方式:文本比较上传者:外部导入
提交:57通过:45
题目描述
爱丽丝要完成一项修剪灌木的工作。
有 N 棵灌木整齐的从左到右排成一排。
爱丽丝在每天傍晚会修剪一棵灌木,让灌木的高度变为 0 厘米。
爱丽丝修剪灌木的顺序是从最左侧的灌木开始,每天向右修剪一棵灌木。
当修剪了最右侧的灌木后,她会调转方向,下一天开始向左修剪灌木。
直到修剪了最左的灌木后再次调转方向。然后如此循环往复。
灌木每天从早上到傍晚会长高 1 厘米,而其余时间不会长高。
在第一天的早晨,所有灌木的高度都是 0 厘米。爱丽丝想知道每棵灌木最高长到多高。
输入格式
一个正整数N ,含义如题面所述。
30%的测试数据:1<N≤10;
100%的测试数据:1<N≤10000。
输出格式
输出 N 行,每行一个整数,第 i 行表示从左到右第 i 棵树最高能长到多高。
输入样例 复制
3
输出样例 复制
4
2
4
分类标签
思路:
略,直接水。
AC代码:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vll2 vector<ll,vector<ll> >
#define vi2 vector<int,vector<int> >
#define pii pair<int,int>
#define pll pair<ll,ll>
int main(){
int n; cin>>n;
for(int i=1;i<=n;i++) cout<<max(i-1,n-i)*2<<endl;
return 0;
}
//ACplease!!!
/* printf(" \n");
printf(" \n");
printf(" * * * * * * * * * * * * \n");
printf(" * * * * * * * * \n");
printf(" * * * * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * \n");
printf(" * * * * * * * * * * * * * * * * * * * * * * * * \n");
*/
版权声明
本文为[joe_zxq的编程世界]所创,转载请带上原文链接,感谢
https://blog.csdn.net/joe_zxq21/article/details/124308734
边栏推荐
- 关于笔记中的操作误删除
- JS - complete Gobang layout in 70 lines
- 外显子bed文件获取
- [词性] 二十三、情态动词 2 [ have to ] [ ought to ] [ dare ] [ be able to ] [ needn‘t ]
- 2022 refrigeration and air conditioning equipment operation test question simulation test question bank and answers
- WinPcap获取设备列表
- ant a-table 树表格级联选择
- Jupyter notebook修改默认开启路径
- Uniapp style penetration
- DNS域名系统-因特网的目录服务
猜你喜欢
随机推荐
作业调度、中级调度、进程调度
[fluent topic] 124 summary of daily problems (III) two or three things about custom dialog
[hand in hand to prepare you for the video game] recent summary
内存模型和名称空间知识点总结
Rose again. In April, the salary of programmers across the country was released, and it became the salary ceiling of the industry? I'm excited after reading it
Responsive layout to realize the static page of ghost blog home page
SAP导出物料库存量代码
Transaction isolation level and mvcc
比 Navicat 还要好用、功能更强大的工具!
Install redis in docker under CentOS
jeecgboot:online表单控件下拉框和下拉搜索框的区别
[Netty ]自己实现一个redis客户端难吗?
51单片机基础之DS18B20温度传感器
requires XXX>=YYY, but you‘ll have XXXX=ZZZ which is incompatible
Common text processing commands
元术练舞室,赛博朋克酷炫风格等你来畅跳
Promise处理复杂异步
网站被挂博彩暗链
Question brushing record (Niuke MySQL)
Promise handles complex asynchrony









