蒟蒻WA了两个,求大佬帮忙看看错哪了
  • 板块P1317 低洼地
  • 楼主CSPJ_AKme
  • 当前回复2
  • 已保存回复2
  • 发布时间2023/7/7 19:22
  • 上次更新2023/11/3 11:09:20
查看原帖
蒟蒻WA了两个,求大佬帮忙看看错哪了
1030814
CSPJ_AKme楼主2023/7/7 19:22
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int height[10005],n,a,num=0;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>height[i];
	}
	a=unique(height+1,height+1+n)-(height+1);
	for(int i=2;i<=a;i++)
	{
		if(height[i]<height[i-1]&&height[i]<height[i+1])
		{
			num++;
		}
	}
	cout<<num;
	return 0;
}
2023/7/7 19:22
加载中...