文章

211

粉丝

0

获赞

1122

访问

37.9k

头像
后缀子串排序 题解:
P1294 上海交通大学机试题
发布于2026年3月15日 19:20
阅读数 39

#include<bits/stdc++.h>
using namespace std;
	
int main(){
	string s;
	while(cin >> s){
		int n = s.length();
		vector<string> str(n);
		for(int i=0;i<n;i++)
			str[i] = s.substr(i);// 从第i位开始到最后	
		sort(str.begin(),str.end());
		for(auto it:str)
			cout << it << endl;
	}	
	return 0;
}	

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发