为什么只有80~~~~~~~~~~

Kinghero King of the summit 2023-10-14 10:06:00 2023-10-14 10:10:32 4

@root

#include<bits/stdc++.h>
using namespace std;
const int MAXN = 10005;
int a[MAXN],dp[MAXN],vis[MAXN];
int n;
int cals()
{
	int i,j,max = 0;
	for(i = 0;i < n;i++)
	{
		dp[i] = 1;
		vis[i] = i;
	}
	for(i = 1;i < n;i++)
	{
		for(j = 0;j < i;j++)
		{
			if(a[i] > a[j] && dp[i] < dp[j] + 1)
			{
				dp[i] = dp[j] + 1;
				vis[i] = j;
			}
		}
	}
	for(i = 0;i < n;i++)
	{
		if(max < dp[i])
		{
			max = dp[i];
		}
	}
	return max;
}
int main()
{
	int i;
	cin>>n;
	for(i = 0;i < n;i++)
	{
		cin>>a[i];
	}
	cout<<cals();
	return 0;
}
{{ vote && vote.total.up }}

共 1 条回复

tctm221

数组小了