Calculate the distance between two points using hdoj 2001

Source: Internet
Author: User

Calculate the distance between two points

Time Limit: 2000/1000 MS (Java/others) memory limit: 65536/32768 K (Java/Others)
Total submission (s): 94573 accepted submission (s): 36296


Problem description

Input two-point coordinates (x1, Y1), (X2, Y2), calculate and output the distance between two points.

Input

There are multiple groups of input data. Each group occupies one row and consists of four real numbers, representing X1, Y1, X2, and Y2 respectively. Data is separated by spaces.

Output

For each group of input data, a row is output, and the result is retained with two decimal places.

Sample Input

 
0 0 0 10 1 1 0

 

Sample output

 
1.001.41

 

 

 
# Include <stdio. h> # include <math. h> int main () {float X1, Y1, X2, Y2, result; while (scanf ("% F", & X1, & Y1, & X2, & Y2 )! = EOF) {result = SQRT (x1-x2) * (x1-x2) + (y1-y2) * (y1-y2); printf ("%. 2f \ n ", result);} return 0 ;}


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.