文章
20
粉丝
0
获赞
51
访问
5.2k
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
bool cmp(string &a, string &b)
{
int c = a.size();
int d = b.size();
if (a.find("-") != string::npos)c--;
if (b.find("-") != string::npos)d--;
if (c != d)return c > d;
else return stoi(a) < stoi(b);
}
int main()
{
vector<string>a;
int k;
while (cin>>k)a.push_back(to_string(k));
sort(a.begin(), a.end(), cmp);
for (vector<string>::iterator it = a.begin(); it != a.end(); it++)cout << *it << " ";
return 0;
}
登录后发布评论
暂无评论,来抢沙发