题解 P6531 【[COCI2015-2016#1] BALONI】
思路:
枚举
代码:
#include<bits/stdc++.h>
using namespace std;
int h,n,ans,a[1000001];
int main()
{
scanf("%d",&n);
while(n--)
scanf("%d",&h),a[h]?a[h]--:ans++,a[h-1]++;
printf("%d",ans);
return 0;
}
在最后求个赞qwq