#includeusing namespace std;int main(){\tconst int SIZE = 100;\tint height[SIZE], num[SIZE], n, ans;\tcin>>n;\tfor (int i = 0; i < n; i ) {\t\tcin>>height[i];\t\tnum[i] = 1;\t\tfor (int j = 0; j < i; j ) {\t\t\tif ((height[j] < height[i]) && (num[j] >= num[i]))\t\t\t\tnum[i] = num[j] 1;\t\t}\t}\tans = 0;\tfor (int i = 0; i < n; i ) {\t\tif (num[i] > ans) ans = num[i];\t}\tcout< 输入:
6
2 5 3 11 12 4
输出:
发表评论 取消回复