题解:
昨天因为看国足然后就没打比赛(赢了hhhhhh,武磊牛逼),然后今天上午做这题的时候卡了一会。。主要是题意很难懂
题意:
王大锤有一堆作品,1表示成功,0表示失败,让你从一堆作品里面剔除几个,使得成功作的后面不能有失败作
坑点:
可以把1的作品也剔除掉。。。因为数据很小直接暴力解决了
代码:
#include<iostream>
#include<cstring>
#include<stdio.h>
#include<math.h>
#include<string>
#include<stdio.h>
#include<queue>
#include<stack>
#include<map>
#include<vector>
#include<deque>
#include<algorithm>
using namespace std;
#define INF 100861111
#define ll long long
#define eps 1e-7
#define lson k*2
#define rson k*2+1
int a[105];
int main()
{
int i,j,n,ans,temp;
scanf("%d",&n);
ans=1;
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
{
temp=0;
for(j=0;j<=i;j++)
{
if(!a[j])
temp++;
}
for(j=i;j<n;j++)
{
if(a[j])
temp++;
}
ans=max(ans,temp);
}
printf("%d\n",ans);
return 0;
}