Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
28582 . 导弹拦截问题 C++ Accepted 32 MS 24152 KB 404 2022-06-24 00:46:55

Tests(10/10):


Code:

#include <bits/stdc++.h> #define left (k<<1) #define right (k<<1|1) using namespace std; const int maxn=3e4+10; int dp[1010][maxn]; int id=0,val; int main() { while(~scanf("%d",&val)) { dp[++id][val]=1; } for(int i=1;i<=id;i++) { for(int j=1;j<maxn;j++) { dp[i][j]=max({dp[i-1][j],dp[i][j-1],dp[i][j]+dp[i-1][j-1]}); } } printf("%d\n",dp[id][maxn-1]); return 0; }