只需要注意两个点是不是在一条直线上就好
#include<bits/stdc++.h>
using namespace std;
int main() {
//cout << " 233 " << endl;
int x, y, i, j, ans;
scanf("%d %d %d %d", &x, &y, &i, &j);
if(x == i || y == j) {
ans = (abs(x-i) + abs(y-j) + 3) * 2;
}
else ans = (abs(x-i) + abs(y-j) + 2) * 2;
cout << ans << endl;
return 0;
}