首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
dxuxu
2026年2月20日 19:03
后缀子串排序 题解:
P1294
回复 0
|
赞 6
|
浏览 132
利用set能自动按升序排序的特性快速求解: #include<bits/stdc++.h> using namespace std; string line; int main(){ while(getline(cin,line)){ set<string> s; for(int i=line.size()-1;i>=0;i--){ s.insert(line.substr(i,line.size())); } for(auto t:s){ cout<<t<<en...
litery
2026年2月12日 15:58
后缀子串排序 题解:
P1294
回复 0
|
赞 1
|
浏览 143
#include <bits/stdc++.h> using namespace std; int main(){ string s; while(cin>>s){ int n=s.size(); string strs[n]; for(int i=0;i<n;i++){ strs[i]=s.substr(i); } sort(strs,strs+n); for(int i=0;i<n;i++...
bro
2026年2月10日 14:55
后缀子串排序 题解: c++
P1294
回复 0
|
赞 1
|
浏览 180
#include <bits/stdc++.h> using namespace std; bool cmp(string a,string b){ return a < b; } int main(){ string s; while(cin >> s){ vector<string> str; str.push_back...
mlx
2026年1月27日 20:37
后缀子串排序 题解:
P1294
回复 0
|
赞 3
|
浏览 258
#include<iostream> #include<algorithm> #include<vector> using namespace std; const int N=1e5+10; string str; int main() { while(cin>>str) { vector<string> s; for(int i=0;i<str.size();i++) s.push_back(str.substr(i)); sort(s.begin(),...
曾不会
2026年1月26日 17:26
后缀子串排序 题解:Python
P1294
回复 0
|
赞 0
|
浏览 178
while(1): try: n=input() l=len(n) t=[] for i in range(l): s=n[i:l] t.append(s) k=sorted(t) for i in k: print(i) except: break
leo110
2025年5月30日 14:21
后缀子串排序 题解:字符串切片+vector
P1294
回复 0
|
赞 2
|
浏览 874
#include<iostream> #include<vector> #include<string> #include<algorithm> using namespace std; void StrSort(const string &s,vector<string> &vec){ for(int i=0;i<s.length();i++){ vec.push_back(...
山崎友希
2025年3月21日 19:32
后缀子串排序 题解:
P1294
回复 0
|
赞 2
|
浏览 1.0k
#include<stdio.h> #include<string.h> int main(){ //char s1[1000][1000]={{"sdad"},{"dsfdsdsesg"},{"我靠!这懒觉好大!!"}}; //s1[0]='sad'; //puts(s1[1]);//验证成功! char a[10...
wwj0102
2025年3月15日 21:15
后缀子串排序 题解:
P1294
回复 0
|
赞 13
|
浏览 1.1k
#include<bits/stdc++.h> using namespace std; int main(){ string s; while(getline(cin,s)){ int ls = s.length(); string t[ls]; string s1 = ""; for(int i = ls - 1; i >= 0; i--){ s1 = s[i] + s1; t[i] = s1; } sort(t,t + ls); for(int i = 0; i < ls; i++...
zxjrheaven
2025年3月14日 13:01
后缀子串排序 题解:暴力,利用map自己喜欢排序的特性
P1294
回复 0
|
赞 2
|
浏览 1.1k
#include <bits/stdc++.h> using namespace std; int main() { string str; while(cin>>str) { map<string,int> mp; while(!str.empty()) ...
shiv15832
2025年3月10日 21:31
后缀子串排序 题解:
P1294
回复 0
|
赞 7
|
浏览 1.4k
显然解题分两步:1,获取子串。2,字典排序。 字典排序很简单,sort函数自然对字符串进行字典排序。而获取子串可以用c++自带的substr函数,具体用法不清楚的可以查一下CSDN或者Deepseek都可以,那么就基本解决了题目,只需要用一个vector存储截取下来的字符串就可以了。 代码: #include<bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; &nb...
1
2
3
4
题目
后缀子串排序
题解数量
37
发布题解
在线答疑
热门题解
1
参考大家的三种方法
2
后缀子串排序 题解:
3
后缀子串排序 题解: c
4
后缀子串排序 题解:
5
使用string类
6
后缀子串排序 题解:
7
后缀子串排序 题解:
8
后缀子串排序 题解:
9
简洁
10
后缀子串排序 题解:C++ sort