说好的入门,怎么有点难度?
2026-01-25 12:54:18
发布于:浙江
13阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int x,max_const1=0,d=0;
for(int i=0;i<n;i++){
cin>>x;
if(x==1) d++;
else if(d>max_const1){
max_const1=d;
d=0;
}
else d=0;
}
if(d>max_const1) max_const1=d;
cout<<max_const1;
return 0;
}
这里空空如也






有帮助,赞一个