首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
奶龙大王
2026年1月25日 15:26
删除字符串 题解:
P1026
回复 0
|
赞 0
|
浏览 164
暴力+memset注意事项 #include <iostream> #include <cmath> // 必须包含 cmath #include<vector> #include<algorithm> #include<cstring> #include<stdlib.h>//memset头文件 using namespace std; int main() { string s; g...
曾不会
2026年1月25日 09:49
删除字符串 题解:
P1026
回复 0
|
赞 0
|
浏览 143
//栈 #include<stdio.h> #include<stack> #include<string.h> using namespace std; int main() { char s[110]; scanf("%s",s); int l=strlen(s); stack<char> hash; for...
senna
2026年1月24日 22:41
删除字符串 题解:for循环暴力
P1026
回复 0
|
赞 6
|
浏览 199
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; string res = ""; for(int i = 0; i < s.size(); i ++){ if(s[i] == 'g' && s[i+1] == '...
bro
2026年1月19日 20:09
删除字符串 题解:c++采用字符串相关函数写法
P1026
回复 0
|
赞 2
|
浏览 212
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string ss = "gzu"; while(s.find(ss) != string::npos) { s.erase(s.find(ss),3); &...
jerryking
2026年1月16日 15:06
删除字符串 题解:c语言解决
P1026
回复 0
|
赞 3
|
浏览 254
#include <stdio.h> #include <string.h> //删除字符串中的字串 void deleteSubStr(char *str,char *substr) { int len1=strlen(str),len2=strlen(substr); while(strstr(str,substr)) { int pos=strstr(str,substr)-str; ...
无名1
2025年9月2日 18:39
删除字符串 题解:C++
P1026
回复 0
|
赞 5
|
浏览 928
#include<bits/stdc++.h> using namespace std; string sShan(string s){ string s1; int l=0; while(l<s.length()){ if(s[l]=='g'&&s[l+1]=='z'&&s[l+2]=='u'){ l+=3; }else{ s1+=s[l]; l++; } } return s1; } int main(){ string s; cin>&g...
阿灿
2025年3月15日 06:01
删除字符串 题解:
P1026
回复 0
|
赞 19
|
浏览 1.5k
#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
|
赞 5
|
浏览 1.4k
#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
|
赞 15
|
浏览 1.8k
//给你一个字符串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
|
赞 42
|
浏览 1.9k
#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...
1
2
3
4
题目
删除字符串
题解数量
40
发布题解
在线答疑
热门题解
1
删除字符串 题解:老老实实,做子串匹配!
2
删除字符串 题解:c 语言解决
3
删除字符串 题解:
4
删除字符串 题解:采用find
5
删除字符串 题解:
6
删除字符串 题解:
7
删除字符串 题解:
8
删除字符串 题解:
9
删除字符串 题解:C
10
删除字符串 题解:for循环暴力