fork download
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. Scanner in = new Scanner(System.in);
  8.  
  9. int tests = in.nextInt();
  10.  
  11. while(tests-- > 0) {
  12. int x = in.nextInt();
  13. int[] array = new int[x];
  14. for (int i = 0; i < x; i++)
  15. array[i] = in.nextInt();
  16.  
  17. int y = 0;
  18.  
  19. for (int i = 0; i < array[0]; i++) {
  20. for (int j = 0; j < x; j++) {
  21. if (array[j] > i)
  22. y++;
  23. }
  24. System.out.print(y + " ");
  25. y = 0;
  26. }
  27. System.out.println();
  28. }
  29. }
  30. }
Success #stdin #stdout 0.12s 29440KB
stdin
2
5
6 4 4 3 1
4
7 5 3 2
stdout
5 4 4 3 1 1 
4 4 3 2 2 1 1