Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 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 Longer_Line
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double x1 = 0;
  14. double y1 = 0;
  15. double x2 = 0;
  16. double y2 = 0;
  17. double x3 = 0;
  18. double y3 = 0;
  19. double x4 = 0;
  20. double y4 = 0;
  21.  
  22. x1 = double.Parse(Console.ReadLine());
  23. y1 = double.Parse(Console.ReadLine());
  24. x2 = double.Parse(Console.ReadLine());
  25. y2 = double.Parse(Console.ReadLine());
  26. x3 = double.Parse(Console.ReadLine());
  27. y3 = double.Parse(Console.ReadLine());
  28. x4 = double.Parse(Console.ReadLine());
  29. y4 = double.Parse(Console.ReadLine());
  30.  
  31.  
  32.  
  33.  
  34.  
  35. if (Point1(x1, y1, x2, y2) > Point2(x3,y3,x4,y4))
  36. {
  37. if (x2 + y2 > x1 + y1)
  38. {
  39. Console.Write($"({x2}, {y2})({x1}, {y1})");
  40. }
  41. else
  42. {
  43. Console.Write($"({x1}, {y1})({x2}, {y2})");
  44. }
  45.  
  46. }
  47. else
  48. {
  49. if (x4 + y4 > x3 + y3)
  50. {
  51. Console.Write($"({x4}, {y4})({x3}, {y3})");
  52.  
  53. }
  54. else
  55. {
  56. Console.Write($"({x3}, {y3})({x4}, {y4})");
  57. }
  58.  
  59. }
  60. }
  61.  
  62.  
  63.  
  64. static double Point1(double x1, double y1, double x2, double y2)
  65. {
  66.  
  67.  
  68.  
  69.  
  70. double a1 = Math.Abs(x1 + y1);
  71. double a2 = Math.Abs(x2 + y2);
  72.  
  73. if (a1>a2)
  74. {
  75.  
  76. return a1;
  77. }
  78. else
  79. {
  80. return a2;
  81. }
  82.  
  83.  
  84. }
  85.  
  86. static double Point2(double x3, double y3, double x4, double y4)
  87. {
  88.  
  89.  
  90.  
  91.  
  92. double a1 = Math.Abs(x3 + y3);
  93. double a2 = Math.Abs(x4 + y4);
  94.  
  95. if (a1 > a2)
  96. {
  97. return a1;
  98. }
  99. else
  100. {
  101. return a2;
  102. }
  103.  
  104.  
  105. }
  106.  
  107. }
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement