fork(1) download
  1. using System;
  2.  
  3. namespace PP0506A
  4. {
  5. class Program
  6. {
  7. static void Main()
  8. {
  9. int ile = int.Parse(Console.ReadLine());
  10. for (int i = 0; i < ile; i++)
  11. {
  12. int ileP = int.Parse(Console.ReadLine());
  13. string[,] tabP = new string[ileP, 4];
  14. int[] tabLicz = new int[ileP];
  15.  
  16. for (int j = 0; j < ileP; j++)
  17. {
  18. string[] punkt = Console.ReadLine().Split(" ");
  19. tabP[j, 0] = punkt[0];
  20. tabP[j, 1] = punkt[1];
  21. tabP[j, 2] = punkt[2];
  22. tabLicz[j] = Math.Abs(int.Parse(punkt[1])) + Math.Abs(int.Parse(punkt[2]));
  23. tabP[j, 3] = tabLicz[j].ToString();
  24. }
  25. Array.Sort(tabLicz);
  26. for (int j = 0; j < ileP; j++)
  27. {
  28. for (int n = 0; n < ileP; n++)
  29. {
  30. if (tabLicz[j].ToString() == tabP[n, 3])
  31. {
  32. Console.WriteLine(tabP[n, 0] + " " + tabP[n, 1] + " " + tabP[n, 2]);
  33. }
  34. }
  35. }
  36. Console.WriteLine();
  37. }
  38. }
  39.  
  40. }
  41. }
Success #stdin #stdout 0.02s 16420KB
stdin
2
3
A 0 0
C 5 5
B 1 -1
1 
X 1 1
stdout
A 0 0
B 1 -1
C 5 5

X 1 1