为什么没有输出啊
查看原帖
为什么没有输出啊
1000915
dfsgbear2楼主2023/9/5 21:11
#include<bits/stdc++.h>
using namespace std;
int dp[50005],n,x,high[50005],ans=-0x3f;
int main(){
	while(cin>>x){
		high[++n]=x;
	}
	n--;
	memset(dp,1,sizeof(dp));
	for(int i=1;i<=n;i++){
		for(int j=1;j<=i;j++){
			if(high[i]<=high[j]){
				dp[i]=max(dp[i],dp[j]+1);
			}
			ans=max(ans,dp[i]);
		}
	}
	cout<<ans;
}
2023/9/5 21:11
加载中...