当前位置:网站首页>刷题-洛谷-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;
}
边栏推荐
猜你喜欢

七夕福利!中奖名单:书籍免费送!

二叉树是否对称

The book "The Essence of Alipay Experience Design", a record of knowledge related to testing

一些性能测试的要点

【着色器实现Glitch单项故障闪烁效果(与Television效果不同)_Shader效果第十四篇】

Ant Group's time series database CeresDB is officially open source

Video Object Detection

seata源码解析:seata server各种消息处理流程

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

Quantitative trading robot system development
随机推荐
Industrial CCD and CMOS camera
Notepad++更改显示背景
JS手写JSON.stringify() (面试)
量化交易机器人系统开发
高效目标检测:动态候选较大程度提升检测精度(附论文下载)
The establishment of simple data cache layer
MySQL远程备份策略举例
The difference between Client Side Cache and Server Side Cache
SIGIR 2022 | 邻域建模Graph-Masked Transformer,显著提高CTR预测性能
The Development and Current Situation of Object Detection
二叉树的前序遍历
Highlights of some performance tests
基于HDF的LED驱动程序开发(2)
[Sql刷题篇] 查询信息数据--Day1
Kubernetes之list-watch机制
5 g NR notes
Aura clock chip generation configuration file script
六月 致 -.-- -..- -
哈佛架构 VS 冯·诺依曼架构
前3名突然变了,揭秘 7 月编程语言最新排行榜