Run ID:149243

提交时间:2026-03-08 15:05:02

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n,a[101],s=0,max=0; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<=n;i++){ s=0; for(int j=1;j<=n;j++){ if(a[i-1]>=2 || a[i-1]<=2) s++; if(a[i+1]>=2 || a[i-1]<=2) s++; if(s>max) max=s; } s=0 } cout<<max; return 0; }