中间3WA,大佬求助orz
查看原帖
中间3WA,大佬求助orz
366446
M_ybChen楼主2021/7/30 13:52
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
string strstrs;
int n,op;
int main(){
	cin>>n;
	cin>>strstrs;
	for(int i=1;i<=n;i++){
		cin>>op;
		if(op==1){
			string str;
			cin>>str;
			strstrs+=str;
			cout<<strstrs<<endl;
		}
		if(op==2){
			int a,b;
			cin>>a>>b;
			string str=strstrs;
			strstrs="";
			for(int j=a;j<=a+b;j++)
				strstrs+=str[j];
			cout<<strstrs<<endl;
		}
		if(op==3){
			string str,qwq="",qaq="";
			int a;
			cin>>a>>str;
			for(int j=0;j<a;j++) 
				qwq+=strstrs[j];
			for(int j=a;j<strstrs.length();j++){
				qaq+=strstrs[j];
			}
			strstrs=qwq+str+qaq;
			cout<<strstrs<<endl;
		}
		if(op==4){
			string str;
			cin>>str;
			if(strstrs.find(str)==-1) cout<<"-1";
			else printf("%d\n",strstrs.find(str));
		}
	}
	return 0;
}
2021/7/30 13:52
加载中...