【題目敘述】https://zerojudge.tw/ShowProblem?problemid=a225
#include <bits/stdc++.h>
using namespace std;
int n, a[1005];
bool cmp(int x, int y){
if (x % 10 != y % 10) return x % 10 < y % 10;
else return x > y;
}
int main(){
while (cin >> n){
for (int i = 0; i < n; i++){
cin >> a[i];
}
sort(a, a+n, cmp);
cout << a[0];
for (int i = 1; i < n; i++){
cout << " " << a[i];
}
cout << "\n";
}
}