Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace BlankProject
- {
- class Program
- {
- static void Main()
- {
- 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());
- CalcClosestPointToZero(x1, y1, x2, y2, x3, y3, x4, y4);
- }
- static void CalcClosestPointToZero(double x1, double y1, double x2, double y2,
- double x3, double y3, double x4, double y4)
- {
- double pointOneCalc = Math.Sqrt((Math.Pow(x1, 2) + Math.Pow(y1, 2)));
- double pointTwoCalc = Math.Sqrt((Math.Pow(x2, 2) + Math.Pow(y2, 2)));
- double pointThreeCalc = Math.Sqrt((Math.Pow(x3, 2) + Math.Pow(y3, 2)));
- double pointFourCalc = Math.Sqrt((Math.Pow(x4, 2) + Math.Pow(y4, 2)));
- double lineOne = pointOneCalc + pointTwoCalc;
- double lineTwo = pointThreeCalc + pointFourCalc;
- string returnPoint;
- returnPoint = (lineOne > lineTwo) ? $"({x1}, {y1})({x2}, {y2})" : $"({x4}, {y4})({x3}, {y3})";
- Console.WriteLine(returnPoint);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement