到了第四个测试点就不执行了
查看原帖
到了第四个测试点就不执行了
786231
wzy091030楼主2023/6/10 17:36

这是代码

#include  <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int l;
    string s;
    cin>>s;
    cout<<endl;
    for(int i=0;i<n;i++)
    {
        cin>>l;
        cout<<"nli:"<<n<<"-"<<l<<"-"<<i<<endl;
        if(l==1)
        {
            string t;
            cin>>t;
            s=s+t;
            cout<<s<<endl;
            continue;
        }
        if(l==2)
        {
            int a,b;
            string t;
            cin>>a>>b;
            for(int j=a;j<=a+b;j++) //b---a+b
            t+=s[j];
            s=t;
            cout<<s<<endl;
            continue;
        }
        if(l==3)
        {
            int a;
            cin>>a;
            string tuo,wei,zhong,lianjie;
            cin>>zhong;
            for(int j=0;j<=a;j++)  //a-->size+a
            {
                tuo+=s[j];
            }
            for(int j=a;j<=s.size();j++)
            {
                wei+=s[j];
            }
            lianjie=tuo+zhong+wei;
            cout<<lianjie<<endl;
            continue;
        }
        if(l==4)
        {
            string t;
            cin>>t;
            cout<<"1111"<<t<<endl;
            for(int j=0;j<=s.size();j++)
            {
                string wzy;
                for(int k=j;k<=j+t.size();k++)
                {
                    wzy+=s[k];
                }
                if(wzy==t)
                {
                    cout<<j<<endl;
                    break;
                }
                else
                cout<<"-1";          
             }
        }
    }
    return 0;
}

求帮忙

2023/6/10 17:36
加载中...