Advertisement
Guest User

Untitled

a guest
Sep 27th, 2016
905
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. class CenterPoint
  5. {
  6. static void Main()
  7. {
  8. double x1 = double.Parse(Console.ReadLine());
  9. double y1 = double.Parse(Console.ReadLine());
  10. double x2 = double.Parse(Console.ReadLine());
  11. double y2 = double.Parse(Console.ReadLine());
  12.  
  13. double dist1 = CalcDistance(x1, y1);
  14. double dist2 = CalcDistance(x2, y2);
  15.  
  16. var list = new List<double>();
  17.  
  18. if (dist1 >= dist2)
  19. {
  20. list.Add(x2);
  21. list.Add(y2);
  22. }
  23. else
  24. {
  25. list.Add(x1);
  26. list.Add(y1);
  27. }
  28.  
  29. Console.Write("(");
  30. Console.Write(String.Join(", ", list));
  31. Console.WriteLine(")");
  32.  
  33. }
  34. public static double CalcDistance(double x, double y)
  35. {
  36. double distance = Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2));
  37. return distance;
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement