Monday, 3 October 2016

Codeforces Round #375 (Div. 2), problem: (A) The New Year: Meeting Friends Solution.

Solution:

#include <bits/stdc++.h>
using namespace std;

int main() {
 int ar[3];
 cin >> ar[0] >> ar[1] >> ar[2];
 sort(ar,ar+3);
 int tot = abs(ar[1]-ar[0])+abs(ar[1]-ar[2]);
 cout << tot << endl;
 return 0;
}

No comments:

Post a Comment