There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the pointx2, and the third friend lives at the point x3. 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.

Input

The first line of the input contains three distinct integers x1, x2 and x3 (1 ≤ x1, x2, x3 ≤ 100) — the coordinates of the houses of the first, the second and the third friends respectively.

Output

Print one integer — the minimum total distance the friends need to travel in order to meet together.

Examples
input
7 1 4
output
6
input
30 20 10
output
20
Note

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.

/*
大意:三个sb,住在一条数轴上,要到一个点集合,问最小总距离
这个其实就是中位数啦,无论向左还是向右都不会更优
*/
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int n[],ans;
int main(){
cin>>n[]>>n[]>>n[];
sort(n+,n+);
ans = abs(n[]-n[]) + abs(n[]-n[]);
cout<<ans;
return ;
}

cf723a The New Year: Meeting Friends的更多相关文章

  1. [LeetCode] Best Meeting Point 最佳开会地点

    A group of two or more people wants to meet and minimize the total travel distance. You are given a ...

  2. [LeetCode] Meeting Rooms II 会议室之二

    Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si ...

  3. [LeetCode] Meeting Rooms 会议室

    Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si ...

  4. Scrum Meeting 20161205

    本周Sprint Master 史少帅 一. 会议概要 作为一个新的sprint的开端,本次scrum meeting总结了每个人过去以来的工作,并明确了下一步的计划,具体如下: 工作总结: · 陈双 ...

  5. Beta阶段第十次Scrum Meeting

    情况简述 BETA阶段第十次Scrum Meeting 敏捷开发起始时间 2017/1/4 00:00 敏捷开发终止时间 2017/1/5 00:00 会议基本内容摘要 deadline到来 参与讨论 ...

  6. Beta阶段第九次Scrum Meeting

    情况简述 BETA阶段第九次Scrum Meeting 敏捷开发起始时间 2017/1/2 00:00 敏捷开发终止时间 2017/1/3 00:00 会议基本内容摘要 deadline临近 参与讨论 ...

  7. Beta阶段第八次Scrum Meeting

    情况简述 BETA阶段第八次Scrum Meeting 敏捷开发起始时间 2016/12/21 00:00 敏捷开发终止时间 2016/12/22 00:00 会议基本内容摘要 deadline临近 ...

  8. Beta阶段第七次Scrum Meeting

    Beta阶段第七次Scrum Meeting 情况简述 BETA阶段第七次Scrum Meeting 敏捷开发起始时间 2016/12/20 00:00 敏捷开发终止时间 2016/12/21 00: ...

  9. Beta阶段第六次Scrum Meeting

    情况简述 BETA阶段第六次Scrum Meeting 敏捷开发起始时间 2016/12/16 00:00 敏捷开发终止时间 2016/12/17 00:00 会议基本内容摘要 平稳推进 参与讨论人员 ...

随机推荐

  1. 找不到mysql.sock,mysql.sock丢失问题解决方法

    Can 't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock '(2) "; 是你的mysql ...

  2. jquery常用函数与方法

    1.delay(duration,[queueName]) 设置一个延时来推迟执行队列中之后的项目.jQuery 1.4新增.用于将队列中的函数延时执行.他既可以推迟动画队列的执行,也可以用于自定义队 ...

  3. psutil一个基于python的跨平台系统信息跟踪模块

    受益于这个模块的帮助,在这里我推荐一手. https://pythonhosted.org/psutil/#processes psutil是一个基于python的跨平台系统信息监视模块.在pytho ...

  4. 更新chrom遇到flash过期解决办法

    更新chrom遇到flash过期解决办法 百度最新adobe flash player ppapi最新版 下载并安装,重启浏览器即可

  5. GLine游戏(Win32GUI实现,CodeBlocks+GCC编译)

    游戏规则: 在10X10的棋盘上有五种颜色的棋子. 点击一个棋子,再点击一个空格子,如果两者之间有一条路径的话,棋子会移动到空格子内. 每移动一次,棋盘上会增加三个棋子,其位置和颜色都是随机的. 当横 ...

  6. UVA 11404 Palindromic Subsequence[DP LCS 打印]

    UVA - 11404 Palindromic Subsequence 题意:一个字符串,删去0个或多个字符,输出字典序最小且最长的回文字符串 不要求路径区间DP都可以做 然而要字典序最小 倒过来求L ...

  7. mybatis缓存

    mybatis缓存http://www.cnblogs.com/QQParadise/articles/5109633.htmlhttp://www.mamicode.com/info-detail- ...

  8. ubuntu系统下,gsl 库链接问题 -undefined reference to `cblas_xxx`

    今天在ubuntu系统下进行程序调试的时候出现以下错误信息: [ %] Linking CXX executable ../test_coco /usr/local/lib/libgsl.so: un ...

  9. Java中的instanceof关键字

    instanceof是Java的一个二元操作符,和==,>,<是同一类东东.由于它是由字母组成的,所以也是Java的保留关键字.它的作用是测试它左边的对象是否是它右边的类的实例,返回boo ...

  10. Error: Could not find the required version of the Java(TM) 2 Runtime Environment in'(null)'.

    今天拿到一台新机器,搭一下开发环境,安装个JDK是个很基本的事情,从Orale的网站上下了个安装,但是一直出下面的错: 我信了你的邪,Google了一圈,有人说是可能文件下载有问题,重新下载安装就可以 ...