为啥三十

P1317 低洼地

因为没有判断洼地存在 **\ \_\_ \_\_ \_\_ /** (即洼地较大)的情况啊 附上我的代码 ```cpp #include<iostream> #include<cstdio> using namespace std; int a[10001],b,ans; int main(){ // freopen("a.in","r",stdin); // freopen("a.out","w",stdout); int n; cin>>n; for(int i=1;i<=n;i++) { scanf("%d",&a[i]); if(a[i]<a[i-1]){ b=1; } if(a[i]>a[i-1]&&b==1) { b=0; ans++; } } cout<<ans; return 0; } ```
by 宇智波佐小助 @ 2017-09-17 10:30:53


|