求助,只对了前2个
查看原帖
求助,只对了前2个
1279518
Vince_ni楼主2024/8/23 15:47
#include<bits/stdc++.h>
using namespace std;
long long n,x=0,sa[200000],ans;
char za[200000];
long long qiu(int a,int b,long long t){
    for(int i=a;i<b;i++){
        if(sa[i]==0&&sa[i+1]==1){
            t+=1;
            t%=12345678910;
        }
        if(sa[i]==0&&sa[i+1]==0){
            int c=i+1,d=-1,e=0,f=0;
            while((sa[i]==0||sa[i+1]==0)&&d!=e){
                i++;
                if(sa[i]==0){
					d++;
					f=1;
				}else{
					e++;
					f=1;
				}
            }
            //cout<<i<<endl;
            t+=2*qiu(c,i,t);
            t%=12345678910;
            //return 2*qiu(c,i);
        }
    }
    return t%=12345678910;
}
int main(){
    //freopen("paren.in","r",stdin);
    //freopen("paren.out","w",stdout);
    cin>>n;
    while(n--){
        cin>>sa[x++];
    }
    ans=qiu(0,x-1,0);
    cout<<ans%12345678910;
    return 0;
}
2024/8/23 15:47
加载中...