Skip to main content
-5 bytes
Source Link
vengy
  • 2.3k
  • 7
  • 30

C (gcc), 109104 bytes

-5 bytes, thanks to @ceilingcat

g(a,b){return b?g(b,a%b):a;abs(a);}main(x,y,a,b){scanf("%d%d%d%d",&x,&y,&a,&b);printf("%u",g(abs(x-a),abs(y-b))-1);}

Try it online!Try it online!

C (gcc), 109 bytes

g(a,b){return b?g(b,a%b):a;}main(x,y,a,b){scanf("%d%d%d%d",&x,&y,&a,&b);printf("%u",g(abs(x-a),abs(y-b))-1);}

Try it online!

C (gcc), 104 bytes

-5 bytes, thanks to @ceilingcat

g(a,b){return b?g(b,a%b):abs(a);}main(x,y,a,b){scanf("%d%d%d%d",&x,&y,&a,&b);printf("%u",g(x-a,y-b)-1);}

Try it online!

Source Link
vengy
  • 2.3k
  • 7
  • 30

C (gcc), 109 bytes

g(a,b){return b?g(b,a%b):a;}main(x,y,a,b){scanf("%d%d%d%d",&x,&y,&a,&b);printf("%u",g(abs(x-a),abs(y-b))-1);}

Try it online!