|
@ -1,15 +1,16 @@ |
|
|
#include <iostream> |
|
|
#include <iostream> |
|
|
|
|
|
using namespace std; |
|
|
int a, b, x, y; |
|
|
int a, b, x, y; |
|
|
|
|
|
|
|
|
int main() { |
|
|
int main() { |
|
|
std::cin >> a >> b >> x >> y; |
|
|
cin >> a >> b >> x >> y; |
|
|
int path1; |
|
|
int path1; |
|
|
int path2; |
|
|
int path2; |
|
|
int path3; |
|
|
int path3; |
|
|
int ans; |
|
|
int ans; |
|
|
path1 = std::abs(a - b); |
|
|
path1 = abs(a - b); |
|
|
path2 = std::abs(a - x) + std::abs(y - b); |
|
|
path2 = abs(a - x) + abs(y - b); |
|
|
path3 = std::abs(a - y) + std::abs(x - b); |
|
|
path3 = abs(a - y) + abs(x - b); |
|
|
ans = path1; |
|
|
ans = path1; |
|
|
if (path2 < ans) { |
|
|
if (path2 < ans) { |
|
|
ans = path2; |
|
|
ans = path2; |
|
@ -17,5 +18,5 @@ int main() { |
|
|
if (path3 < ans) { |
|
|
if (path3 < ans) { |
|
|
ans = path3; |
|
|
ans = path3; |
|
|
} |
|
|
} |
|
|
std::cout << ans << std::endl; |
|
|
cout << ans << endl; |
|
|
} |
|
|
} |
|
|