'commit'
This commit is contained in:
20
TangDou/AcWing/DP/LIS/Test.cpp
Normal file
20
TangDou/AcWing/DP/LIS/Test.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
const int N = 1010;
|
||||
int n;
|
||||
int a[N], f[N];
|
||||
int res;
|
||||
|
||||
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[i] > a[j]) f[i] = max(f[i], f[j] + 1);
|
||||
res = max(res, f[i]);
|
||||
}
|
||||
printf("%d", res);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user