CF723A.The New Year: Meeting Friends

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There are three friend living on the straight line OxOx in Lineland. The first friend lives at the point x1x_{1} , the second friend lives at the point x2x_{2} , and the third friend lives at the point x3x_{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.

输入格式

The first line of the input contains three distinct integers x1x_{1} , x2x_{2} and x3x_{3} ( 1<=x1,x2,x3<=1001<=x_{1},x_{2},x_{3}<=100 ) — the coordinates of the houses of the first, the second and the third friends respectively.

输出格式

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 44 . Thus, the first friend has to travel the distance of 33 (from the point 77 to the point 44 ), the second friend also has to travel the distance of 33 (from the point 11 to the point 44 ), while the third friend should not go anywhere because he lives at the point 44 .

首页