C++代码
2026-10-03 13:53:00
发布于:湖南
1阅读
0回复
0点赞
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n,a[100010];
bool cmp( int x, int y )
{
int u = x % 10;
int v = y % 10;
if( u != v ) return u > v;
else return x < y;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for(int i = 0; i < n; i++) cin >> a[i];
sort( a, a + n, cmp );
for(int i = 0; i < n; i++) cout << a[i] << endl;
return 0;
}
这里空空如也






有帮助,赞一个