传送
#include<iostream> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if(d < c)swap(d, c); if(a > b)swap(a,b); int len = 0; if(c < a) { len = min(a - c, d - a); } else len = abs(c - a); len += abs(b - d); len = min(len, abs(b - a)); cout << len << endl; return 0; }