Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _09_Longer_Line
- {
- class Program
- {
- static void Main(string[] args)
- {
- double x1 = double.Parse(Console.ReadLine());
- double y1 = double.Parse(Console.ReadLine());
- double x2 = double.Parse(Console.ReadLine());
- double y2 = double.Parse(Console.ReadLine());
- double x3 = double.Parse(Console.ReadLine());
- double y3 = double.Parse(Console.ReadLine());
- double x4 = double.Parse(Console.ReadLine());
- double y4 = double.Parse(Console.ReadLine());
- Console.WriteLine(CenterPoint(x1, y1, x2, y2, x3, y3, x4, y4));
- }
- static string CenterPoint(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
- {
- double combinationOne = Math.Abs(x1) + Math.Abs(y1);
- double combinationTwo = Math.Abs(x2) + Math.Abs(y2);
- double combinationOneTwo = Math.Abs(combinationOne) + Math.Abs(combinationTwo);
- double combinationThree = Math.Abs(x3) + Math.Abs(y3);
- double combinationFour = Math.Abs(x4) + Math.Abs(y4);
- double combinationThreeFour = Math.Abs(combinationThree) + Math.Abs(combinationFour);
- string result = "";
- if (combinationOneTwo >= combinationThreeFour)
- {
- if (combinationOne <= combinationTwo)
- {
- result = $"({x1}, {y1})({x2}, {y2})";
- }
- else
- {
- result = $"({x2}, {y2})({x1}, {y1})";
- }
- }
- else
- {
- if (combinationOne <= combinationTwo)
- {
- result = $"({x3}, {y3})({x4}, {y4})";
- }
- else
- {
- result = $"({x4}, {y4})({x3}, {y3})";
- }
- }
- return result;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement