CodeForces 620A Professor GukiZ's Robot
水题
#include<cstdio> #include<cstring> #include<cmath> #include<stack> #include<vector> #include<string> #include<iostream> #include<algorithm> using namespace std; int sx,sy; int ex,ey; int main() { scanf("%d%d",&sx,&sy); scanf("%d%d",&ex,&ey); int ans; int lenx=abs(ex-sx); int leny=abs(ey-sy); ans=min(lenx,leny)+lenx-min(lenx,leny)+leny-min(lenx,leny); printf("%d\n",ans); return 0; }