A. Professor GukiZ's Robot
time limit per test

0.5 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Professor GukiZ makes a new robot. The robot are in the point with coordinates (x1, y1) and should go to the point (x2, y2). In a single step the robot can change any of its coordinates (maybe both of them) by one (decrease or increase). So the robot can move in one of the 8 directions. Find the minimal number of steps the robot should make to get the finish position.

Input

The first line contains two integers x1, y1 ( - 109 ≤ x1, y1 ≤ 109) — the start position of the robot.

The second line contains two integers x2, y2 ( - 109 ≤ x2, y2 ≤ 109) — the finish position of the robot.

Output

Print the only integer d — the minimal number of steps to get the finish position.

Sample test(s)
Input
0 0
4 5
Output
5
Input
3 4
6 1
Output
3
Note

In the first example robot should increase both of its coordinates by one four times, so it will be in position (4, 4). After that robot should simply increase its y coordinate and get the finish position.

In the second example robot should simultaneously increase x coordinate and decrease y coordinate by one three times.

题意 初始位置(x1,y1) 目标位置(x2,y2)

可以行走8个方向 问最小步数

题解 max{abs(x1-x2),abs(y1-y2)}

#include<bits/stdc++.h>
using namespace std;
#define LL __int64
int main()
{
LL a ,b, c, d;
LL x,y;
scanf("%I64d%I64d%I64d%I64d",&a,&b,&c,&d);
x=abs(a-c);
y=abs(b-d);
if(x>y)
printf("%I64d\n",x);
else
printf("%I64d\n",y); return 0;
}

  

最新文章

  1. [Java面试六]SpringMVC总结以及在面试中的一些问题.
  2. app中Webview实现下载表格
  3. 【视频】从零开始编写第一个PHP扩展
  4. PLSQL 的简单命令之五
  5. Struts2文件上传
  6. Word embedding blog
  7. jquery的each()函数用法
  8. ASP.Net MVC_DotNetZip简单使用方法,解决文件压缩的问题[转]
  9. [转]&quot;由于这台计算机没有远程桌面客户端访问许可证,远程会话被中断&quot;的解决方案
  10. yii框架的foreach 已经优化好了,可以“$user_model-&gt;attributes=$_POST[&#39;Admin&#39;];”
  11. UVa 11796 计算几何
  12. android中怎么调整字体的间距和行间距
  13. 【转载】访问WEB-INF目录中的JSP文件
  14. 径向基网络(RBF network)
  15. scrapy 博客爬取
  16. Windows服务器防火墙配置规范
  17. spring集成jedis简单实例
  18. Centos下PPTP环境部署记录
  19. 听说,你也一直钟爱着equals。。。
  20. NOIP2017普及组T1题解

热门文章

  1. 【picker】选择器组件说明
  2. Leetcode-跳跃游戏
  3. 【带 josn参数的测法】
  4. 本地矩阵(Local Matrix)
  5. ubuntu 18.04 LTS server系统安装失败问题解决
  6. fp-growth树创建代码及详细注释
  7. isX字符串方法
  8. FFM
  9. Median of Two Sorted Arrays(hard)
  10. Java中Collection和Collections的区别(转载)