文章

81

粉丝

0

获赞

328

访问

22.2k

头像
简单排序 题解:还是拉了
P1929 湘潭大学2023年机试题
发布于2025年3月16日 00:11
阅读数 163

#include<bits/stdc++.h>
using namespace std;
int main(){
	int i,max=0,n;
	cin>>n;
	string str;
	map<string,int> m;
	for(i=0;i<n;i++){
		cin>>str;
		m[str] = str.length();
		if(str.length()>max){
			max = str.length();
		}
	}
	for(i=0;i<=max;i++){
		for(const auto &p:m){
			if(i==p.second){
				cout<<p.first<<endl;
			}
		}
	}
	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发