Advertisement
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 Next
- {
- class Program
- {
- static void Main(string[] args)
- {
- // DateTime input = DateTime.ParseExact(
- // Console.ReadLine(), "d-M-yyyy", System.Globalization.CultureInfo.InvariantCulture
- // );
- //
- // Console.WriteLine(input.DayOfWeek);
- Point firstPoint = Point.ParsePoint(Console.ReadLine());
- Point secondPoint = Point.ParsePoint(Console.ReadLine());
- double distance = CalcDistance(firstPoint, secondPoint);
- Console.WriteLine($"{distance:f3}");
- }
- private static double CalcDistance(Point firstPoint, Point secondPoint)
- {
- double sideA = Math.Pow((firstPoint.X - secondPoint.X), 2);
- double sideB = Math.Pow((firstPoint.Y - secondPoint.Y), 2);
- return Math.Sqrt(sideA + sideB);
- }
- private static Point ReadPoint(string input)
- {
- int[] inputData = input.Split(' ').Select(int.Parse).ToArray();
- return new Point(inputData[0], inputData[1]);
- }
- class Point
- {
- public int X { get; set; }
- public int Y { get; set; }
- public Point(int xCoord, int yCoord)
- {
- X = xCoord;
- Y = yCoord;
- }
- public static Point ParsePoint(string input)
- {
- int[] inputData = input.Split(' ').Select(int.Parse).ToArray();
- return new Point(inputData[0], inputData[1]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement