You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
539 B

#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
const int INF = 0x3f3f3f3f;
int a[N];
int n;
int cnt;
/**
3
130 200 55
*/
void dfs(int step, int sum, int m) {
if (step == n + 1) {
cnt = max(cnt, sum);
return;
}
if (m > a[step]) {
dfs(step + 1, sum + 1, a[step]);
dfs(step + 1, sum, m);
} else
dfs(step + 1, sum, m);
}
int main() {
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i]; // 130 200
dfs(1, 0, INF);
printf("%d", cnt);
return 0;
}