题目链接http://codeforces.com/contest/723/problem/A
思路
大水题,暴力求解
#include<stdio.h>
#include<algorithm>
#include<math.h>
#define inf 99999999
using namespace std;
int main(){
int a1,a2,a3;
scanf("%d%d%d",&a1,&a2,&a3);
int ans=inf;
for(int i=1;i<=100;i++){
int t=fabs(i-a1)+fabs(i-a2)+fabs(i-a3);
ans=min(ans,t);
}
printf("%d\n",ans);
return 0;
}