The New Year: Meeting Friends
time limit per test 1 second memory limit per test 256 megabytes
input standard input output standard output

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.

传送门:CF723A

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.

Sample Input

1
7 1 4

Sample Output

1
6

题解

一条直线上三点距离最短,那么肯定在最小和最大的之间,而最小点和最大点在中间相遇的距离是固定的,所以答案就是最大点减去最小点。
## AC code:(不包含输入类)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import java.io.*;  
import java.util.*;

public class Main {

public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
int min=101;
int max=-1;
int a=sc.nextInt();
if(a<min){
min=a;
}
if(a>max){
max=a;
}
int b=sc.nextInt();
if(b<min){
min=b;
}
if(b>max){
max=b;
}
int c=sc.nextInt();
if(c<min){
min=c;
}
if(c>max){
max=c;
}
int da=max-min;
System.out.println(da);
}

}

}