首页
DreamJudge
院校信息
专业题库
模拟考试
机试真题
上岸课程
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
阿灿
2025年3月15日 06:01
删除字符串 题解:
P1026
回复 0
|
赞 9
|
浏览 201
#include<bits/stdc++.h> using namespace std; int main(){ string input,ans; int i; getline(cin,input); while(input.find("gzu")!= string::npos){ input.erase(input.find("gzu"),3); } cout<<input<<endl; return 0; } erase find string::npos
blackbook537
2025年3月13日 10:46
删除字符串 题解:strstr() + memmove()
P1026
回复 0
|
赞 2
|
浏览 234
#include<stdio.h> #include<string.h> void removeSubstr(char *str, const char *sub){ int len = strlen(sub); char *pos; while((pos = strstr(str, sub))!=NULL){//strstr取出sub memmov...
quyang
2025年2月28日 20:20
删除字符串 题解:采用find
P1026
回复 0
|
赞 10
|
浏览 415
//给你一个字符串S,要求你将字符串中出现的所有"gzu"子串删除,输出删除之后的S。 #include<iostream> #include<string> using namespace std; int main(){ string s; getline(cin,s); while(s.find("gzu")!=string::npos){ ...
拉萨小队长
2024年4月24日 22:25
删除字符串 题解:老老实实,做子串匹配!
P1026
回复 0
|
赞 24
|
浏览 898
#include<bits/stdc++.h> using namespace std; int main(){ char s[100]; gets(s); int len=strlen(s); for(int i=0;i<len;i++){ if(s[i]=='g'&&s[i+1]=='z'&&s[i+2]=='u...
Candour
2024年4月20日 16:22
删除字符串 题解:
P1026
回复 0
|
赞 9
|
浏览 952
#include<bits/stdc++.h> using namespace std; int main() { string str; getline(cin, str); for(int i = 0; i < str.size(); i ++) { if(str[i] == 'g' && str[i + 1] == 'z' && str[i + 2] =='u') { i += 2; continue; } cout << str[i] ...
20082123
2024年3月29日 10:45
删除字符串 题解:
P1026
回复 0
|
赞 2
|
浏览 664
#include<bits/stdc++.h> using namespace std; int main(){ string s; int k; cin>>s; while(1){ k=s.find("gzu"); if(k!=...
orderrr
2024年3月18日 18:12
删除字符串 题解:c 语言解决
P1026
回复 0
|
赞 13
|
浏览 961
#include <stdio.h> #include <string.h> int main() { char s[101]; scanf("%s", s); int i = 0; while (s[i] != '\0') { if (s[i] == 'g' && s[i + 1] == 'z' && s[i + 2] == 'u' && i <= strlen(s) - 2) { ...
小酒
2024年3月15日 15:31
删除字符串 题解:
P1026
回复 0
|
赞 1
|
浏览 867
1026解题思路 #include <bits/stdc++.h> using namespace std; int main() { char a[105]={0}; char b[105]={0}; gets(a); int l=strlen(a); int j=0; for(int i=0;i<l;i++) { if(a[i]=='g'&&a[i+1]=='z'&&a[i+2]=='u') { //b[j++]=a[i+3]; i=i+2; } ...
FIVEszc
2024年3月13日 20:58
删除字符串 题解:C++
P1026
回复 0
|
赞 0
|
浏览 794
#include <bits/stdc++.h> using namespace std; int main() { char s[100]; fgets(s,100,stdin); string str=s; while(str.find("gzu")!=-1){ int pos=str.find("gzu"); str.erase(pos,3); } printf("%s",str.c_str()); return 0; }
Cookie‘s AE86
2024年3月13日 10:48
删除字符串 题解:s.find();s.erase()实现
P1026
回复 0
|
赞 2
|
浏览 561
#include<bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int mark = s.find("gzu"); while(mark != -1){ s.erase(mark, 3); mark = s.find("gzu"); } cout << s; return 0; }
1
2
3
题目
删除字符串
题解数量
24
发布题解
在线答疑
热门题解
1
删除字符串 题解:老老实实,做子串匹配!
2
删除字符串 题解:c 语言解决
3
删除字符串 题解:采用find
4
删除字符串 题解:
5
删除字符串 题解:
6
删除字符串 题解:C
7
题解:删除字符串
8
删除字符串(跟前面同学的有点不一样)
9
删除字符串 题解:
10
删除字符串 题解:C