CF723A.The New Year: Meeting Friends
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There are three friend living on the straight line Ox in Lineland. The first friend lives at the point _x_1, the second friend lives at the point _x_2, and the third friend lives at the point _x_3. They plan to celebrate the New Year together, so they need to meet at one point. What is the minimum total distance they have to travel in order to meet at some point and celebrate the New Year?
It's guaranteed that the optimal answer is always integer.
在直线 Ox 上的林兰德(Lineland)住着三位朋友。第一位朋友住在点 x1,第二位朋友住在点 x2,第三位朋友住在点 x3。他们计划一起庆祝新年,因此需要在某一个点会合。为了在某一点会合并庆祝新年,他们总共需要行走的最小距离是多少?
保证最优答案恒为整数。
输入格式
The first line of the input contains three distinct integers _x_1, _x_2 and _x_3 (1 ≤ _x_1, _x_2, _x_3 ≤ 100) — the coordinates of the houses of the first, the second and the third friends respectively.
输入的第一行包含三个互不相同的整数 x1、x2 和 x3(1 ≤ x1, x2, x3 ≤ 100),分别表示第一位、第二位和第三位朋友家的坐标。
输出格式
Print one integer — the minimum total distance the friends need to travel in order to meet together.
输出一个整数——朋友们为会合所需行走的最小总距离。
输入输出样例
输入#1
7 1 4
输出#1
6
输入#2
30 20 10
输出#2
20
说明/提示
In the first sample, friends should meet at the point 4. Thus, the first friend has to travel the distance of 3 (from the point 7 to the point 4), the second friend also has to travel the distance of 3 (from the point 1 to the point 4), while the third friend should not go anywhere because he lives at the point 4.
在第一个样例中,朋友们应在点 4 处会面。因此,第一位朋友需要行走距离 3(从点 7 到点 4),第二位朋友也需要行走距离 3(从点 1 到点 4),而第三位朋友无需移动,因为他就住在点 4。
输入解题思路,AI测评打分。不知道怎么写?