DEV.和在线IDE中的样例全过了,只有最后一点AC,求助大佬们
查看原帖
DEV.和在线IDE中的样例全过了,只有最后一点AC,求助大佬们
421841
xianxuejiying1421楼主2021/4/17 15:09
#include<bits/stdc++.h>
using namespace std;
int main(){
    int q,a,b;
    string shi,z,i;
    cin>>q>>shi;
    int ac[q];
    for(int i=0;i<q;i++){
        cin>>ac[i];
        if(ac[i]==1){
			cin>>z;
			shi+=z;
			cout<<shi<<endl; 
		}
        if(ac[i]==2){
            cin>>a>>b;
            shi=shi.substr(a,b);
            cout<<shi<<endl;
        }
        if(ac[i]==3){
			cin>>a>>z;
			shi=shi.insert(a,z);
			cout<<shi<<endl;
		}
        if(ac[i]==4){
            cin>>z;
            i=shi.find(z);
            if(i!=string::npos) cout<<i<<endl;
            else cout<<"-1"<<endl;
            return 0;
        }
    }
    return 0;
}
2021/4/17 15:09
加载中...