首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
mlx
2026年2月9日 16:15
字符串排序2 题解:
P1255
回复 0
|
赞 6
|
浏览 186
#include<iostream> #include<algorithm> #include<cstring> using namespace std; const int N=110; char str[N]; bool cmp(char a,char b) { int x,y; if(a>='a'&&a<='z') x=a-'a'; else x=a-'A'; if(b>='a'&&b<='z') ...
曾不会
2026年2月7日 14:29
字符串排序2 题解:
P1255
回复 0
|
赞 0
|
浏览 161
while(1): try: s=input() k=[] for i in s: if i.isalpha(): k.append(i) t=sorted(k,key=lambda x:x.lower()) index=0 for i in s: if i.isalpha(): print(t[index],end='') ...
cczz
2025年8月6日 17:41
字符串排序2 题解:
P1255
回复 0
|
赞 14
|
浏览 740
#include<bits/stdc++.h> using namespace std; int main(){ string line; while(getline(cin, line)){ vector<char> letters; // 提取并存储字母 for(char &c : line){ if(isalpha(c)) letters.push_back(c); } // 对字母序列进行稳定排序 stable_sort(letters.begin(), letters...
dhh390
2025年3月20日 17:12
字符串排序2 题解:同样用冒泡排序,只不过需要在冒泡排序加一些特殊处理
P1255
回复 0
|
赞 14
|
浏览 1.4k
#include <stdio.h> #include <string.h> #include<stdlib.h> #include<math.h> int main() { char s[1000]; fgets(s,999,stdin); int len=strlen(s); if(len>0&&s[len-1]=='\n') &...
zhangs
2025年3月18日 14:42
字符串排序2 题解:
P1255
回复 0
|
赞 10
|
浏览 1.5k
//c语言插入排序 #include <stdio.h> #include <stdlib.h> #include <string.h> char g(char c){ if(c>='A'&&c<='Z') return c+32; else if(c>='a'&&c<='z') return c; ...
gxtbdarkness
2025年3月16日 17:24
字符串排序2 题解:链表解
P1255
回复 0
|
赞 0
|
浏览 731
#include <bits/stdc++.h> using namespace std; typedef struct node{ char e; struct node *link; }Node; Node* getNode(char e){ Node *node = (Node*)malloc(sizeof(Node)); node->e = e; n...
RingoCrystal
2025年1月27日 15:45
字符串排序2 题解:stablesort,大小写同时排序
P1255
回复 1
|
赞 89
|
浏览 2.1k
#include <bits/stdc++.h> using namespace std; bool compare(char c,char b){ if(c>='A'&&c<='Z')c=c-'A'+'a'; if(b>='A'&&b<='Z')b=b-'A'+'a'; return c<b; } int main(){ string s; while(getline(cin,s)){ string c; f...
zxjrheaven
2025年3月15日 01:01
字符串排序2 题解:暴力,确实是好题
P1255
回复 0
|
赞 7
|
浏览 1.1k
#include <bits/stdc++.h> using namespace std; bool cmp(char a,char b) { if(a>='a'&&a<='z')a=a-32; if(b>='a'&&b<='z')b=b-32; return a<b; } int main() { ...
西电机试专家
2025年3月13日 21:47
字符串排序2 题解:好题
P1255
回复 0
|
赞 9
|
浏览 960
#include <bits/stdc++.h> using namespace std; bool compare(char a,char b){//仅比较字母,非字母不予处理 if(a>='A'&&a<='Z')a+=32; if(b>='A'&&b<='Z')b+=32; return a<b; } int main(){ ...
GENARDING
2025年3月12日 20:57
在前人的基础上又优化了一下,应该是最简易懂了
P1255
回复 0
|
赞 13
|
浏览 1.1k
#include <bits/stdc++.h> using namespace std; bool compare(char c, char b) { return tolower(c) < tolower(b); // 忽略大小写排序 } int main() { string s; while (getline(cin, s)) { string c; for (char x : s) { if (isalpha(x)) c += x; } ...
1
2
3
4
题目
字符串排序2
题解数量
34
发布题解
在线答疑
热门题解
1
字符串排序2 题解:stablesort,大小写同时排序
2
参考大家的简化了cmp
3
字符串排序2 题解:
4
字符串排序2 题解:
5
字符串排序2 题解:借鉴了前人的做法
6
字符串排序2 题解:
7
字符串排序2 C语言题解:依旧qsort稳定排序
8
字符串排序2 题解:
9
字符串排序2 题解: c++ ,用stable_sort
10
字符串排序2 题解:同样用冒泡排序,只不过需要在冒泡排序加一些特殊处理