CodeForces 620 A. Professor GukiZ's Robot(水~)
来源:互联网 发布:nginx后端获取真实ip 编辑:程序博客网 时间:2024/05/14 11:13
Description
一个机器人每步可以往四周八个方向走,问该机器人从(x1,y1)到(x2,y2)所需的最少步数是多少
Input
四个整数x1,y1,x2,y2(-10^9<=x1,y1,x2,y2<=10^9)
Output
机器人从(x1,y1)到(x2,y2)所需的最少步数
Sample Input
0 0
4 5
Sample Output
5
Solution
水题,ans=max(abs(x1-x2),abs(y1-y2))
Code
#include<cstdio>#include<iostream>#include<algorithm>using namespace std;typedef long long ll;ll x1,y1,x2,y2,ans;int main(){ while(~scanf("%I64d%I64d%I64d%I64d",&x1,&y1,&x2,&y2)) { ll dx=abs(x1-x2),dy=abs(y1-y2); ans=max(dx,dy); printf("%I64d\n",ans); }}
0 0
- CodeForces 620 A. Professor GukiZ's Robot(水~)
- CodeForces 620A Professor GukiZ's Robot
- Codeforces-Edu6-A. Professor GukiZ's Robot
- A. Professor GukiZ's Robot
- Educational Codeforces Round 6 A. Professor GukiZ's Robot
- Educational Codeforces Round 6-A. Professor GukiZ's Robot(简单几何)
- 【Educational Codeforces Round 6A】【水题】Professor GukiZ's Robot 曼哈顿距离
- D-Professor GukiZ's Robot
- CodeForces 620 D.Professor GukiZ and Two Arrays(枚举+set)
- CodeForces 620D Professor GukiZ and Two Arrays
- Codeforces-620d Professor GukiZ and Two Arrays
- Codeforces D. Professor GukiZ and Two Arrays
- Professor GukiZ and Two Arrays CodeForces
- Educational Codeforces Round 6 D. Professor GukiZ and Two Arrays(二分 | two pointers)
- Educational Codeforces Round 6 D. Professor GukiZ and Two Arrays(二分 | two pointers)
- Educational Codeforces Round 6 D. Professor GukiZ and Two Arrays
- CodeForces 626 A. Robot Sequence(水~)
- CodeForces 551A GukiZ and Contest(模拟)
- 重载运算符
- nginx启动、关闭、重启
- linux设备驱动归纳总结(六):3.中断的上半部和下半部——工作队列
- JavaScript
- OpenCV实践之路——TrackBar调整图像的亮度和对比度(OpenCV1和OpenCV2两种版本)
- CodeForces 620 A. Professor GukiZ's Robot(水~)
- 2.10 Android 代码的混淆
- 【翻译】Leapmotion-python开发官方文档(5)
- 问题:java小程序在打开时被安全设置阻止,无法打开java小程序
- 326. Power of Three
- Spring中IOC的实现
- java POST GET 请求
- mahout处理路透社语料步骤,转换成需要的格式
- how to tell if a library contain debug symbols or not