第三个测试点WA了,求大佬帮忙解答!
查看原帖
第三个测试点WA了,求大佬帮忙解答!
996200
President_Zhao楼主2023/7/19 14:48
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int b,c;
	string a,d;
	cin>>b>>a;
	for(int y=0;y<b;y++)
	{
		cin>>c;
		if(c==1)
		{
			cin>>d;
			cout<<a.append(d)<<endl;
			a=a.append(d);
		}
		else if(c==2)
		{
			int o,p;
			cin>>o>>p;
			cout<<a.substr(o,p)<<endl;
			a=a.substr(o,p);
		}
		else if(c==3)
		{
			int q;
			string bbb;
			cin>>q>>bbb;
			cout<<a.insert(q,bbb)<<endl;
			a=a.insert(q,bbb);
		}
		else if(c==4)
		{
			string sss;
			cin>>sss;
			if(a.find(sss)<a.size())
			cout<<a.find(sss)<<endl;
			else
			cout<<-1<<endl;
		}
	}
}
2023/7/19 14:48
加载中...