哪位大佬帮孩子看一下吧~dev 能通过测试用例,已搬到oj上就全红了,呜呜呜呜
查看原帖
哪位大佬帮孩子看一下吧~dev 能通过测试用例,已搬到oj上就全红了,呜呜呜呜
516107
Facmina楼主2021/5/8 16:28
#include <bits/stdc++.h>
using namespace std;

int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	
	for(int i = 1; i <= n; i++)
	{
		string temp;
		int j; 
		if(i == 1)
		{
			cin >> j >> temp;
			s += temp;
			cout << s << endl;
		}
		if(i == 2)
		{
			int start, count;
			cin >> j >> start >> count;
			s = s.substr(start, count);
			cout << s << endl;
		}
		if(i == 3)
		{
			int index;
			string temp2, temp3;
			cin >> j >> index >> temp2;
			temp = s.substr(index);
			s = s.substr(0, index) + temp2 + temp;
			cout << s << endl;
		}
		if(i == 4)
		{
			cin >> j >> temp;
			int t = s.find(temp);
			if(t >= 0 && t < s.size())
				cout << t;
			else
				cout << "-1";
		}
	}
	return 0;
}
2021/5/8 16:28
加载中...