首页
DreamJudge
院校信息
专业题库
模拟考试
机试真题
上岸课程
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
16696033405
2025年3月24日 17:42
删除字符串2 题解:
P1027
回复 0
|
赞 1
|
浏览 92
#include <stdio.h> #include <string.h> #include <ctype.h> #define MAX 1000 int main() { char s[MAX], result[MAX]; int i = 0, j = 0; // 读取输入 fgets(s, MAX, stdin); s[strcspn(s, "\n")] = ...
123456上岸
2025年3月17日 20:16
删除字符串2 题解:
P1027
回复 0
|
赞 9
|
浏览 243
#include<iostream> #include<string> using namespace std; int main(){ string s; cin>>s; int flag = 1; while(flag){ int t=-1; //记录出现“gzu”下标 ...
cc12345
2025年3月17日 10:41
删除字符串2 题解:后值覆盖gzu,判断数目再输出。
P1027
回复 0
|
赞 8
|
浏览 236
#include<bits/stdc++.h> using namespace std; int main(){ string s; getline(cin,s); int len=s.length(); int num=0; for(int i=0;i<len-3;i++) { if((s[i]=='G'||s[i]=='g')&&(s[i+1]=='Z'||s[i+1]=='z')&&(s[i+2]=='U'||s[i+2]=='u')) { num+=3; for(int j=i;j<len-...
ASDF807
2025年3月15日 15:47
删除字符串2 题解:C
P1027
回复 0
|
赞 10
|
浏览 223
#include<stdio.h> #include<string.h> int main() { char str[100]; fgets(str,101,stdin); int len = strlen(str)-1; for(int i=0;i<len;i++) { if((str[...
阿灿
2025年3月15日 06:09
删除字符串2 题解:直接八种情况上
P1027
回复 0
|
赞 3
|
浏览 171
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; while(s.find("gzu")!= string::npos){ s.erase(s.find("gzu"),3); } while(s.find("Gzu")!= string::npos){ s.erase(s.find("Gzu"),3); } while(s.find("GZU")!= string::npos){ s.erase(s.find("...
blackbook537
2025年3月13日 11:14
删除字符串2 题解:memmove加strncasecmp
P1027
回复 0
|
赞 0
|
浏览 184
#include<stdio.h> #include<string.h> #include<ctype.h> char *strcasestr(const char *haystack, const char *needle){ if(!*needle) return (char *)haystack; size_t needle_len = strlen(needle); for(; ...
cccccuda
2025年3月12日 21:27
删除字符串2 题解:复制一份转小写
P1027
回复 0
|
赞 4
|
浏览 154
#include <iostream> using namespace std; int main() { string s; getline(cin,s); string cpy=s; //将s全部转化为小写 for(int i=0; i<s.size(); i++) { if(s[i]>='A'&...
samxz
2025年3月11日 20:22
删除字符串2 题解:不考虑新组合,del[i]存储跳跃点
P1027
回复 0
|
赞 4
|
浏览 315
#include<stdio.h> #include<stdlib.h> #include<string.h> int main(){ char s[1001]; gets(s); int n=strlen(s); int del[1001]; int deli=0; for(int i=0;i<n;i++){ if( (s[i+2]=='U'||s[i+2]=='u')&& (s[i+1]=='Z'||s[i+1]=='z')&& (s[i]==...
xddddddddddddd
2025年3月10日 13:29
删除字符串2 题解:方法二:不考虑删除后是否出现新组合
P1027
回复 0
|
赞 3
|
浏览 126
#include<iostream> #include<string> using namespace std; int main(){ string s; cin >> s; for(int i=0;i<s.length();i++){ //逻辑短路避免越界 &nbs...
xddddddddddddd
2025年3月10日 13:07
删除字符串2 题解:考虑是否出现新组合,KMP
P1027
回复 0
|
赞 1
|
浏览 158
#include<iostream> #include<string> #include<algorithm> #include<vector> using namespace std; void getNext(const string& pattern, vector<int>& next) { int len = pattern.length(); int k = -1, j = 0; &...
1
2
3
...
5
题目
删除字符串2
题解数量
48
发布题解
在线答疑
热门题解
1
删除字符串2 题解:C
2
简单易懂
3
删除字符串2 题解:
4
删除字符串2 题解:
5
删除字符串2 题解:C++
6
删除字符串2 题解:C
7
删除字符串2 题解:
8
删除字符串2 题解:后值覆盖gzu,判断数目再输出。
9
删除字符串2 题解:
10
删除字符串2 题解: