|
@@ -0,0 +1,27 @@
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Comparator;
|
|
|
+import java.util.Scanner;
|
|
|
+
|
|
|
+public class F {
|
|
|
+ public static void main(String[] args) {
|
|
|
+ while (cin.hasNext()) {
|
|
|
+ int n = cin.nextInt();
|
|
|
+ if (n == 0) break;
|
|
|
+ Integer[] a = new Integer[n];
|
|
|
+ for (int i = 0; i < a.length; i++) a[i] = cin.nextInt();
|
|
|
+ Arrays.sort(a, new Comparator<Integer>() {
|
|
|
+ @Override
|
|
|
+ public int compare(Integer o1, Integer o2) {
|
|
|
+ return Math.abs(o2) - Math.abs(o1);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ for (int i = 0; i < a.length; i++) {
|
|
|
+ if (i > 0) System.out.print(" ");
|
|
|
+ System.out.print(a[i]);
|
|
|
+ }
|
|
|
+ System.out.println();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ static Scanner cin = new Scanner(System.in);
|
|
|
+}
|