文章

121

粉丝

0

获赞

422

访问

19.2k

头像
查找 - 北邮 题解:
P1387 北京邮电大学
发布于2026年2月9日 16:02
阅读数 115

#include<iostream>
#include<algorithm>
using namespace std;

string str;
int n;

int main()
{
	string op;
	while(cin>>str)
	{
		cin>>n;
		for(int i=0;i<n;i++)
		{
			cin>>op;
			if(op[0]=='0')
			{
				int index=op[1]-'0';
				int len=op[2]-'0';
				reverse(str.begin()+index,str.begin()+index+len);
			}
			else
			{
			    string s=op.substr(3);
				int index=op[1]-'0';
				int len=op[2]-'0';
				str.replace(index,len,s);
			}
			cout<<str<<endl;
		}
	}
	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发