最开始想用stack的栈来顺序排列,但是ta没有迭代器很难判断,其他的容器也没有想到更好的,索性用数组做,没想到一波就出来了hhhh
#include<iostream>
#include<algorithm>
#include<stack>
using namespace std;
int main()
{
int n;
cin >> n;
int *a = new int[n]();//无法赋初值为1,所以结果+1
int *b = new int[n]();//申请动态内存
for (int i = 0; i < n; i++)
{
int x;
cin >> x;
a[i] = x;
}
int max = 1;
for (int i = 0; i < n; i++)//for循环 分别判断不同固定起点上升子序列
{
for (int j = i + 1; j < n; j++)
{
if (a[j] > a[j - 1])
b[i]++;
else
continue;
}
}
sort(b, b + n);
cout << b[n-1];
return 0;
}