首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
AORIE
2026年3月26日 09:52
删除字符串 题解:
P1026
回复 0
|
赞 0
|
浏览 4
#include <stdio.h> #include <string.h> char a[103]; char *b = "gzu"; int main(){ scanf("%s",a); int k = strlen(a); for(int i=0;i<k;i++){ if(a[i]== 'g'){ if(a[i+1]=='z'&&a[i+2]=='u'){ i+=2; }else printf("%c",a[i]); } else printf("%c",a...
HKX9XAS
2026年3月20日 12:48
删除字符串 题解:erase
P1026
回复 0
|
赞 1
|
浏览 90
#include<stdio.h> #include<malloc.h> #include<iostream> #include<math.h> #include<stack> #include<string> #include<map> using namespace std; int main(){ string c; while(cin>>c){ &nb...
ZeroQi_404
2026年3月11日 15:45
删除字符串 题解:
P1026
回复 0
|
赞 13
|
浏览 257
#include<iostream> using namespace std; int main(){ string s; cin >> s; for(int i=0;i<s.size();i++){ if(s[i] == 'g' &&s[i+1] =='z' && s[i+2] == 'u'){ i=i+2; } else cout << s[i]; ...
sadhjksdj
2026年3月10日 15:33
删除字符串 题解:
P1026
回复 0
|
赞 5
|
浏览 150
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; //在字符串中找gzu,find方法若找不到则会返回-1 while(s.find("gzu") != -1){ int index = s.find(&qu...
这里是小小菊
2026年3月9日 10:50
删除字符串 题解:
P1026
回复 0
|
赞 3
|
浏览 123
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; for(int i=2;i<(int)s.size();i++){ if(s[i] == 'u' && s[i-1] ...
ca7
2026年3月4日 22:27
删除字符串 题解:
P1026
回复 0
|
赞 2
|
浏览 110
为了写kmp而写kmp哈哈哈 // // Created by 67234 on 2026/3/4. // //只为手搓kmp //删除应该从后往前删不然下标会错位 #include<bits/stdc++.h> using namespace std; vector<int> getNext(string s) { vector<int> next(s.size(), 0); for (int i = 1, j = 0; i < s.size(); i++) { ...
dxuxu
2026年2月5日 19:40
删除字符串 题解:
P1026
回复 0
|
赞 12
|
浏览 284
api是个好东西 #include<bits/stdc++.h> using namespace std; string line; int main(){ getline(cin,line); while(true){ int i=line.find("gzu"); if(i<0) break; line.erase(i,3); } cout<<line; return 0; }
xsw
2026年2月4日 12:49
删除字符串 题解:
P1026
回复 0
|
赞 9
|
浏览 189
#include<iostream> using namespace std; int main() { string s; cin >> s; string str; for (int i = 0; i < s.size(); i ++ ) { if (s.substr(i, 3) == "gzu") i += 2; else str += s[i]; } cout << str << endl; return 0; }
mlx
2026年1月31日 16:46
删除字符串 题解:
P1026
回复 0
|
赞 3
|
浏览 246
#include<iostream> using namespace std; string str; int main() { cin>>str; while(str.find("gzu")!=string::npos) { int index=str.find("gzu"); str.erase(index,3); } cout<<str; return 0; }
yauqq
2026年1月28日 16:12
删除字符串 题解:
P1026
回复 0
|
赞 0
|
浏览 266
#include<bits/stdc++.h> using namespace std; int main(){ string str; cin >> str; while(str.find("gzu")!= string::npos){ str.erase(str.find("gzu"),3); } cout<< str <<endl; return 0; }
1
2
3
4
题目
删除字符串
题解数量
40
发布题解
在线答疑
热门题解
1
删除字符串 题解:老老实实,做子串匹配!
2
删除字符串 题解:c 语言解决
3
删除字符串 题解:
4
删除字符串 题解:采用find
5
删除字符串 题解:
6
删除字符串 题解:
7
删除字符串 题解:
8
删除字符串 题解:
9
删除字符串 题解:C
10
删除字符串 题解:for循环暴力