两点距离
Time Limit:1000MS Memory Limit:65536K
Total Submit:495 Accepted:227
Description
输入4个绝对值在1000000以内的整数 x1,y1,x2,y2, 输出平面坐标系中点 (x1,y1)到点(x2,y2)之间的距离(保留三位小数)
Input
输入4个整数 x1,y1,x2,y2,
Output
输出平面坐标系中点 (x1,y1)到点(x2,y2)之间的距离(保留三位小数)
Sample Input
0 0 3 4
Sample Output
5.000
Source
lrj程序入门
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AK1102 {
class Program {
static void Main(string[] args) {
string[] values = Console.ReadLine().Split(' ');
double x1 = double.Parse(values[0]), y1 = double.Parse(values[1]);
double x2 = double.Parse(values[2]), y2 = double.Parse(values[3]);
double l = Math.Sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
string s = l.ToString("0.000");
Console.WriteLine(s);
}
}
}