diff --git a/AcWing/895/895.cpp b/AcWing/895/895.cpp new file mode 100644 index 00000000..5cfd727a --- /dev/null +++ b/AcWing/895/895.cpp @@ -0,0 +1,23 @@ +#include + +using namespace std; + +int n, a[1005], f[1005], ans; + +int main() { + cin >> n; + for (int i = 1; i <= n; i++) { + cin >> a[i]; + } + for (int i = 1; i <= n; i++) { + f[i] = 1; + for (int j = 1; j < i; j++) { + if (a[j] < a[i]) { + f[i] = max(f[i], f[j] + 1); + } + } + ans = max(ans, f[i]); + } + cout << ans << endl; + return 0; +}