Advertisement
plamen27

Longer Line fixed

Oct 2nd, 2016
788
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _9.Longer_Line
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double x1 = double.Parse(Console.ReadLine());
  14. double y1 = double.Parse(Console.ReadLine());
  15. double x2 = double.Parse(Console.ReadLine());
  16. double y2 = double.Parse(Console.ReadLine());
  17. double x3 = double.Parse(Console.ReadLine());
  18. double y3 = double.Parse(Console.ReadLine());
  19. double x4 = double.Parse(Console.ReadLine());
  20. double y4 = double.Parse(Console.ReadLine());
  21.  
  22. double line1 = Math.Sqrt((x1- x2)*(x1- x2) + (y1- y2)*(y1 - y2));
  23. double line2 = Math.Sqrt((x3 - x4) * (x3 - x4) + (y3 - y4)*(y3 - y4));
  24.  
  25. if (line1 >= line2)
  26. {
  27. bool first = true;
  28. if (Math.Sqrt(x1*x1 + y1*y1) > Math.Sqrt(x2 * x2 + y2 * y2))
  29. first = false;
  30. if (first)
  31. Console.WriteLine($"({x1}, {y1})({x2}, {y2})");
  32. else Console.WriteLine($"({x2}, {y2})({x1}, {y1})");
  33. }
  34. else
  35. {
  36. bool first = true;
  37. if (Math.Sqrt(x3 * x3 + y3 * y3) > Math.Sqrt(x4 * x4 + y4 * y4))
  38. first = false;
  39. if (first)
  40. Console.WriteLine($"({x3}, {y3})({x4}, {y4})");
  41. else Console.WriteLine($"({x4}, {y4})({x3}, {y3})");
  42. }
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement