f
2025-08-22 16:27:28
发布于:广东
1阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
struct node{
int o,p;
}a[100005];
bool cmp(node x,node y){
if(x.p!=y.p)return x.p>y.p;
else return x.o<y.o;
}
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i].o;
a[i].p=a[i].o%10;
}
sort(a+1,a+n+1,cmp);
for(int i=1;i<=n;i++){
cout<<a[i].o<<endl;
}
}
这里空空如也
有帮助,赞一个