Problem:
Distance

Write a program which calculates the distance between two points P1(x1, y1) and P2(x2, y2).

Input

Four real numbers x1, y1, x2 and y2 are given in a line.

Output

Print the distance in real number. The output should not contain an absolute error greater than 10-4.

Sample Input

0 0 1 1

Sample Output

1.41421356

Solution in C# (judge verdict: Wrong Answer)

using System;
class main{
    static void Main(string[] args){
        string[] line = Console.ReadLine().Split(' ');
        double x1 = double.Parse(line[0]);
        double y1 = double.Parse(line[1]);
        double x2 = double.Parse(line[2]);
        double y2 = double.Parse(line[3]);
        double x = 0;
        double y = 0;
        double distance = 0;
        if(x1>0 && x2>0){
            if (x1 > x2)
            {
                x = x1 - x2;
            }
        }
        else if (x1 <= 0 && x2 <= 0)
        {
            if (x1 > x2)
            {
                x = x2 + x1;
            }
        }
        else if (x1 > 0)
        {
            x = x1 + x2;
        }
        else
        {
            x = x2 + x1;
        }

        if (y1 > 0 && y2 > 0)
        {
            if (y1 > y2)
            {
                y = y1 - y2;
            }
        }
        else if (y1 <= 0 && y2 <= 0)
        {
            if (y1 > y2)
            {
                y = y1 - y2;
            }
        }
        else if (y1 > 0)
        {
            y = y1 + y2;
        }
        else
        {
            y = y2 + y1;
        }

        distance = Math.Sqrt(x * x + y * y);
        Console.WriteLine("{0:f6}", distance);
    }
}