标签:style cto 子序列 n+1 int names color max data
#include <iostream> #include <vector> #include <algorithm> using namespace std; const int maxn = 100; int main() { int n; cin >> n; vector<int> datas; while (n--) { int tem; cin >> tem; datas.push_back(tem); } int dp[maxn]; //fill(dp, dp + n+1, 1); int m = 0; for (int i = 0; i < datas.size(); ++i) { dp[i] = 1; for (int j = 0; j < i; ++j) { if (datas[i] > datas[j] && (dp[j] + 1 > dp[i])) dp[i] = dp[j] + 1; if (m < dp[i])m = dp[i]; } } cout << m << endl; system("pause"); return 0; }
标签:style cto 子序列 n+1 int names color max data
原文地址:http://www.cnblogs.com/babyking1/p/6877149.html