数字排序 题解:c++最简洁解法
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
vector<string> s(n);
for(auto &i:s)
cin>>i;
sort(s.begin(),s.end(),[](string a,string b){
return stold(a)<stold(b);
});
for (auto &num:s) {
cout<<num<<endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发