20 lines
343 B
C++
20 lines
343 B
C++
#include <algorithm>
|
|
#include <cstdio>
|
|
#include <iostream>
|
|
#include <vector>
|
|
using namespace std;
|
|
|
|
int main() {
|
|
freopen("paint.in", "r", stdin);
|
|
freopen("paint.out", "w", stdout);
|
|
|
|
int a, b, c, d;
|
|
cin >> a >> b >> c >> d;
|
|
|
|
if (d < a || b < c) {
|
|
cout << (b - a) + (d - c);
|
|
} else {
|
|
cout << abs(max(b, d) - min(a, c));
|
|
}
|
|
}
|