当前位置:网站首页>刷题-洛谷-P1317 低洼地
刷题-洛谷-P1317 低洼地
2022-08-04 19:44:00 【宋向上_UP】
P1317 低洼地-C语言
1、题目

2、求解过程
结果:
代码:
//洛谷 P1317 低洼地
#include <stdio.h>
#define NUM 10000
int main() {
int n;
int level[NUM];//水平高度
int i,j;
int counter = 0;//计数器
scanf("%d", &n);
j = 0;
for (i = 0; i < n; i++) {
//输入n次
scanf("%d", &level[j]);
if (level[j] == level[j - 1]) {
//出现平台
j = j - 1;
}
j++;
}
for (i = 1; i < n-1; i++) {
if (level[i] < level[i - 1] && level[i] < level[i + 1]) {
counter++;//统计低洼地
}
}
printf("%d", counter);
return 0;
}
边栏推荐
- AWS SES 的监控和告警
- Client Side Cache 和 Server Side Cache 的区别
- Ant Group's time series database CeresDB is officially open source
- Finished product upgrade program
- Dragoma (DMA) Metaverse System Development
- 图片延迟加载、预加载
- hash和history路由的区别
- June To -.-- -..- -
- really time ntp service start command
- 前3名突然变了,揭秘 7 月编程语言最新排行榜
猜你喜欢

Quantitative trading robot system development

SIGIR 2022 | 邻域建模Graph-Masked Transformer,显著提高CTR预测性能

Dragoma (DMA) Metaverse System Development

【ASP.NET Core】 中间件

VQ Realization of Wavelet Extraction Features

ERC20转账压缩

v-model的使用

Yuanguo chain game system development

Orthodontic MIA micro-implant anchorage technology China 10th anniversary exchange meeting was held in Shenyang

华为交换机:STP测试实验
随机推荐
红外图像滤波
完善的交叉编译环境记录 peta 生成的shell 脚本
The book "The Essence of Alipay Experience Design", a record of knowledge related to testing
工业相机CCD与CMOS
简易数据缓存层的建立
JSD-2204-酷莎商城(管理员模块)-密码加密-Day10
The list of Kubernetes - watch mechanism
Go study notes (Part 1) Configuring the Go development environment
哈佛架构 VS 冯·诺依曼架构
02 ts 变量定义,类型
How to add custom syntax to MySQL?
hash和history路由的区别
03 ts类型缩小,函数
用“绿色计算“技术推动算力可持续发展
awk 统计平均 最大 最小值
awk statistical difference record
Video Object Detection
使用 Chrome 开发者工具 coverage 功能分析 web 应用的渲染阻止资源的执行分布情况
Notepad++更改显示背景
really time ntp服务启动命令