mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-10 00:18:48 +00:00
P5734 【深基6.例6】文字处理软件
R35887921
This commit is contained in:
parent
aeb10e48a7
commit
4caca6f202
47
problem/P5734/P5734.cpp
Normal file
47
problem/P5734/P5734.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
// https://www.luogu.com.cn/record/35887921
|
||||
|
||||
#include<bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int n = 0;
|
||||
cin >> n;
|
||||
string s = "";
|
||||
cin >> s;
|
||||
for(int i = 0 ; i < n ; i++) {
|
||||
int act;
|
||||
cin >> act;
|
||||
if (act == 1) {
|
||||
string s1;
|
||||
cin >> s1;
|
||||
s += s1;
|
||||
cout << s;
|
||||
}
|
||||
else if (act == 2) {
|
||||
int st, ed;
|
||||
cin >> st >> ed;
|
||||
s = s.substr(st, ed);
|
||||
cout << s;
|
||||
}
|
||||
else if (act == 3) {
|
||||
int st;
|
||||
string s1;
|
||||
cin >> st >> s1;
|
||||
s.insert(st, s1);
|
||||
cout << s;
|
||||
}
|
||||
else if (act == 4) {
|
||||
string s1;
|
||||
cin >> s1;
|
||||
if(s.find(s1) < s.size()) {
|
||||
cout << s.find(s1);
|
||||
}
|
||||
else {
|
||||
cout << "-1";
|
||||
}
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
BIN
problem/P5734/data/P5734_1.in
(Stored with Git LFS)
Normal file
BIN
problem/P5734/data/P5734_1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
problem/P5734/data/P5734_1.out
(Stored with Git LFS)
Normal file
BIN
problem/P5734/data/P5734_1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user