Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## 我的 0ms 加了快读才30行

Posted by ACAccepted at 2019-04-16 09:00:23 on Problem 2385 and last updated at 2019-04-29 09:32:09
```欢迎来访：https://www.cnblogs.com/lzxzy-blog/p/10714970.html

/*****************************************
Problem: 2385
Author: ACAccepted
Language: C++
Result: Accepted
Time:0 ms
Memory:180 kb
Web:https://www.cnblogs.com/lzxzy-blog/p/10714970.html
*****************************************/
#include <cstdio>
#define max(a,b) ((a)>(b)?(a):(b))
using namespace std;

{
int x=0,f=1;char c=getchar();
while (c<'0' || c>'9'){if (c=='-')f=-1;c=getchar();}
while (c>='0'&&c<='9'){x=(x<<1)+(x<<3)+c-48;c=getchar();}
return x*f;
}

const int MAXN=1005;
const int MAXM=45;
int n,m;
int a[MAXN];
int f[MAXN][MAXM];

int main()
{
for (int i=1;i<=n;i++)
for (int j=0;j<=m;j++)
f[i][j]=max(f[i-1][j],f[i-1][j-1])+((j&1)==a[i]);
int ans=0;
for (int i=0;i<=m;i++)
ans=max(ans,f[n][i]);
printf("%d\n",ans);
return 0;
}```

Followed by: