forked from abheekd/usaco-practice
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
364 B
22 lines
364 B
#include <iostream>
|
|
using namespace std;
|
|
int a, b, x, y;
|
|
|
|
int main() {
|
|
cin >> a >> b >> x >> y;
|
|
int path1;
|
|
int path2;
|
|
int path3;
|
|
int ans;
|
|
path1 = abs(a - b);
|
|
path2 = abs(a - x) + abs(y - b);
|
|
path3 = abs(a - y) + abs(x - b);
|
|
ans = path1;
|
|
if (path2 < ans) {
|
|
ans = path2;
|
|
}
|
|
if (path3 < ans) {
|
|
ans = path3;
|
|
}
|
|
cout << ans << endl;
|
|
}
|
|
|