Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication12
- {
- 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());
- if (LineWidth(x1, y1, x2, y2) >= LineWidth(x3, y3, x4, y4))
- {
- if (CloserPoint(x1, y1, x2, y2))
- {
- Console.WriteLine("({0}, {1})({2}, {3})", x1, y1, x2, y2);
- }
- else
- {
- Console.WriteLine("({0}, {1})({2}, {3})", x2, y2, x1, y1);
- }
- }
- else {
- if (CloserPoint(x3, y3, x4, y4))
- {
- Console.WriteLine("({0}, {1})({2}, {3})", x3, y3, x4, y4);
- }
- else
- {
- Console.WriteLine("({0}, {1})({2}, {3})", x4, y4, x3, y3);
- }
- }
- }
- static double LineWidth(double x1, double y1, double x2, double y2) {
- double xCoordinate = x2 - x1;
- double yCoordinate = y2 - y1;
- double width = Math.Sqrt(Math.Pow(xCoordinate, 2) + Math.Pow(yCoordinate, 2));
- return width;
- }
- static bool CloserPoint(double x1,double y1,double x2,double y2) {
- bool isCloser = false;
- if ((Math.Abs(x1) <= Math.Abs(x2)) && (Math.Abs(y1) <=Math.Abs(y2))) {
- isCloser = true;
- }
- return isCloser;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment