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.
|
|
|
|
#include <bits/stdc++.h>
|
|
|
|
|
using namespace std;
|
|
|
|
|
const int N = 1010;
|
|
|
|
|
const int INF = 0x3f3f3f3f;
|
|
|
|
|
int a[N];
|
|
|
|
|
int n;
|
|
|
|
|
int res;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
测试用例:
|
|
|
|
|
3
|
|
|
|
|
130 200 55
|
|
|
|
|
|
|
|
|
|
最多投进球的个数
|
|
|
|
|
答案:2
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:深度优先搜索
|
|
|
|
|
* @param u 选择了哪个篮筐
|
|
|
|
|
* @param last 前面最后一个数字是多少
|
|
|
|
|
* @param cnt 已经投中了多少个球
|
|
|
|
|
*/
|
|
|
|
|
void dfs(int u, int pre, int cnt) {
|
|
|
|
|
if (u == n + 1) {
|
|
|
|
|
res = max(res, cnt);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (a[u] < pre) dfs(u + 1, a[u], cnt + 1);
|
|
|
|
|
dfs(u + 1, pre, cnt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
cin >> n;
|
|
|
|
|
for (int i = 1; i <= n; i++) cin >> a[i];
|
|
|
|
|
dfs(1, INF, 0);
|
|
|
|
|
printf("%d\n", res);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|