0
点赞
收藏
分享

微信扫一扫

洛谷P1317 低洼地(凹点 坡)

老牛走世界 2022-02-25 阅读 26

 

#include<stdio.h>
main()
{
	int n,i,before,after,left=0,count=0;
	scanf("%d",&n);
	scanf("%d",&before);
	for(i=2;i<=n;i++)
	{
		scanf("%d",&after);
		if(after<before)
		left=1;
		if(after>before&&left==1)//不能大于等于,如钝角型满足条件但不是积水低洼地
		{
			count++;
			left=0;//记得归零
		}
		before=after;
	}
	printf("%d",count);
}

 

举报

相关推荐

低洼地 luogu

洛谷p1135

洛谷p1551

洛谷P1309

洛谷 P1307

P1217(洛谷)

洛谷p1443

洛谷P1090

洛谷P2084

0 条评论