hh
2023-01-08 10:48:12
发布于:江苏
33阅读
0回复
0点赞
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{
int n;
int a[1100], f[1100], ans = 0;
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> a[i];
f[i] = 1;
}
for (int i = 2; i <= n; i++)
for (int j = 1; j < i; j++)
if (a[j] < a[i])
f[i] = max(f[i], f[j] + 1);
for (int i = 1; i <= n; i++)
ans = max(ans, f[i]);
cout << ans;
return 0;
}
这里空空如也
有帮助,赞一个