fork(1) download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. int ile,ile2;
  8. int zliczacz = 0;
  9. string w = "";
  10. string wyraz = "";
  11. string tmp = "";
  12. ile = Convert.ToInt32(Console.ReadLine());
  13. for (int i = 0; i < ile; i++)
  14. {
  15. ile2 = Convert.ToInt32(Console.ReadLine());
  16. string[] a = Console.ReadLine().Split(' ');
  17. int max = Convert.ToInt32(a[0]);
  18. for (int j = 0; j < ile2; j++)
  19. {
  20. for (int k = 0; k < a.Length-1; k++)
  21. {
  22. if (Convert.ToInt32(a[k]) > max)
  23. {
  24. max = Convert.ToInt32(a[k]);
  25. }
  26. }
  27. if (max == Convert.ToInt32(a[j]))
  28. {
  29. zliczacz++;
  30.  
  31. }
  32. wyraz += a[j]+" ";
  33. }
  34. Array.Sort(a);
  35. for (int k = 0; k < a.Length-zliczacz; k++)
  36. {
  37. tmp+=a[k]+" ";
  38. }
  39. for (int h = 0; h < zliczacz; h++)
  40. {
  41. w+=max+" ";
  42. }
  43. string tmp2="";
  44. if (w.EndsWith(" "))
  45. {
  46. for (int j = 0; j < w.Length-1; j++)
  47. {
  48. tmp2 += w[j];
  49. }
  50. }
  51. if (tmp.EndsWith(" "))
  52. {
  53. for (int j = 0; j < tmp.Length-1; j++)
  54. {
  55. tmp2 += tmp[j];
  56. }
  57. }
  58. Console.WriteLine(tmp2);
  59. zliczacz = 0;
  60. max = 0;
  61. w = "";
  62. wyraz = "";
  63. tmp = "";
  64. }
  65. }
  66. }
Success #stdin #stdout 0.01s 131776KB
stdin
3
5
1 2 3 4 5 
5
4 5 2 3 5 
2
1 1
stdout
5 1 2 3 4
5 5 2 3 4
1 1