fork download
  1. import java.io.*;
  2. import java.math.*;
  3. import java.util.*;
  4.  
  5. public final class Main {
  6. private static final class tokens extends LinkedList<String> {
  7. tokens(String line) {
  8. super(new LinkedList<String>());
  9. for (String token: line.split(" "))
  10. add(token); }
  11. int nextInt() { return Integer.parseInt(remove()); } }
  12. private static tokens nextLine(BufferedReader cin) {
  13. String line = null;
  14. try { line = cin.readLine(); }
  15. catch (IOException e) { e.printStackTrace(); }
  16. return new tokens(line); }
  17. private static byte[] to_bytes(String s) { return s.getBytes(); }
  18. private static byte[] to_bytes(Integer x) { return to_bytes(x.toString()); }
  19. private final static byte[] space = to_bytes(" ");
  20. private final static byte[] endl = to_bytes("\n");
  21. public static void main(String[] args) throws IOException {
  22. final InputStreamReader istream = new InputStreamReader(System.in);
  23. final BufferedReader cin = new BufferedReader(istream);
  24. final int M = 101;
  25. for (int T = nextLine(cin).nextInt(); T > 0; --T) {
  26. final int[] count = new int[M];
  27. final int N = nextLine(cin).nextInt();
  28. final tokens A = nextLine(cin);
  29. for (int i = 0; i < N; ++i)
  30. ++count[A.nextInt()];
  31. for (int a = 1; a < M; ++a)
  32. if (count[a] > 0) {
  33. byte[] s = to_bytes(a);
  34. for (int c = count[a]; c > 0; --c) {
  35. cout.write(s);
  36. cout.write(space); } }
  37. cout.write(endl); }
  38. cout.flush(); } }
  39.  
Success #stdin #stdout 0.09s 51312KB
stdin
2
5
7 2 9 10 1
4
3 7 7 3
stdout
1 2 7 9 10 
3 3 7 7