src2020/4078_3people/threepeople.cpp

37 lines
655 B
C++

#include <iostream>
using namespace std;
int pan(int a, int b)
{
return a > b ? a : b;
}
int main()
{
int a, b, c;
cin >> a >> b >> c;
if (a > b) {
int u = a;
a = b;
b = u;
}
if (a > c) {
int u = a;
a = c;
c = u;
}
if (b > c) {
int u = c;
c = b;
b = u;
}
if (a + 1 == b && b + 1 == c) {
cout << "0" << endl
<< "0";
return 0;
}
if (a + 2 == b || b + 2 == c) {
cout << "1" << endl;
} else {
cout << "2" << endl;
}
cout << pan(b - a, c - b)-1;
}