You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
459 B
C++

#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
int a[110],n;
struct cmp
{
bool operator()(int l,int r)
{
return abs(l)>abs(r);
}
};
int main()
{
while(scanf("%d",&n),n)
{
for(int i=0; i<n; i++)
scanf("%d",a+i);
sort(a,a+n,cmp());
for(int i=0; i<n-1; i++)
printf("%d ",a[i]);
printf("%d\n",a[n-1]);
}
return 0;
}