题解
2023-07-10 14:48:37
发布于:上海
41阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
const unsigned MAX=1e6+5;
unsigned n,a[MAX],dp[MAX],temp,maxx=0;
int main(){
	cin>>n;
	for (int i=0;i<n;i++) cin>>a[i];
	
	for (int i=0;i<n;i++){
		temp=1;
		for (int j=0;j<i;j++){
			
			if (a[j] < a[i]) temp = max(temp,dp[j]+1);
		}
		dp[i] = temp;
	}
	
	for (int i=0;i<n;i++) maxx = max(dp[i],maxx);
	
	cout<<maxx;
	return 0;
} 
这里空空如也

有帮助,赞一个