水题

#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 ;
}

CodeForces 620A Professor GukiZ's Robot的更多相关文章

  1. Educational Codeforces Round 6 A. Professor GukiZ's Robot 水

    A. Professor GukiZ's Robot   Professor GukiZ makes a new robot. The robot are in the point with coor ...

  2. CodeForces 620D Professor GukiZ and Two Arrays 双指针

    Professor GukiZ and Two Arrays 题解: 将a数组都sort一遍之后, b数组也sort一遍之后. 可以观察得到 对于每一个ai来说, 整个数组bi是一个V型的. 并且对于 ...

  3. codeforces 620D Professor GukiZ and Two Arrays

    #include <bits/stdc++.h> using namespace std; + ; const long long inf = 1e18; int n, m; long l ...

  4. Educational Codeforces Round 6 D. Professor GukiZ and Two Arrays 二分

    D. Professor GukiZ and Two Arrays 题目连接: http://www.codeforces.com/contest/620/problem/D Description ...

  5. Educational Codeforces Round 6 D. Professor GukiZ and Two Arrays

    Professor GukiZ and Two Arrays 题意:两个长度在2000的-1e9~1e9的两个序列a,b(无序);要你最多两次交换元素,使得交换元素后两序列和的差值的绝对值最小:输出这 ...

  6. 【24.67%】【codeforces 551C】 GukiZ hates Boxes

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  7. 【74.89%】【codeforces 551A】GukiZ and Contest

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  8. codeforces 551 C GukiZ hates Boxes

    --睡太晚了. ..脑子就傻了-- 这个题想的时候并没有想到该这样-- 题意大概是有n堆箱子从左往右依次排列,每堆ai个箱子,有m个人,最開始都站在第一个箱子的左边, 每个人在每一秒钟都必须做出两种选 ...

  9. 【CodeForces 620D】Professor GukiZ and Two Arrays

    题 题意 两个数列,一个有n个数,另一个有m个数,让你最多交换两次两个数列的数,使得两个数列和的差的绝对值最小,求这个差的绝对值.最少交换次数.交换数对 分析 交换0次.1次可得到的最小的差可以枚举出 ...

随机推荐

  1. 【匈牙利算法】 二分图模板 poj 1274

    #include <iostream> #include <cstdio> #include <memory.h> using namespace std; int ...

  2. Lua 基础 -- 学习笔记

    标签(空格分隔): Lua 1. Lua可以一次性给多个变量赋值 变量比赋值多,多的变量就赋值nil 变量比赋值少,多的赋值舍弃 local a, b, c = 1, 2, 3 print( a, b ...

  3. php事件驱动

    1. [文件] class.Dispatcher.php ~ 967B     下载(9) ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 ...

  4. cURL: Learning..

    CURL usage.. -v, -m, -H, -I, -s, --connect-timeout, -x, -X GET|POST, -d, -T, -o. --retry, -u curl [o ...

  5. Python 文件Hash(MD5,SHA1)

    import hashlib import os,sys   def CalcSha1(filepath):     with open(filepath,'rb') as f:         sh ...

  6. UVALive 7291 Kinfolk(最近公共祖先)

    题目中的描述就很最近公共祖先,再说其实这个题并不难,就是麻烦点(代码其实可以化简的),我写的判定比较多. 方法:求出两者的最近公共祖先lca,在求出两者到lca的距离 分析:给出a和b,如果LCA(a ...

  7. POJ 1061 青蛙的约会(欧几里得扩展)

    题意:已知青蛙1位置x,速度m,青蛙2位置y,速度n,纬线长度为l,求他们相遇时最少跳跃次数. 思路:设最小跳跃次数为k,则(x + k*m) - (y + k*n) = q*l:经过整理得到k*(n ...

  8. cocos2d-js 帧序列动画

    1.resource.js var res = { playerWalk_plist:"res/playerWalk.plist", playerWalk_png:"re ...

  9. HDU 3346 Lucky Number

    水题 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> us ...

  10. 第11章 类的高级特性--final

    1.final变量 (1)final关键字可用于变量声明,一旦该变量被设定,就不可以再改变该变量的值.通常,由final定义的变量为常量.例如:final double PI=3.14; final关 ...