看了题解  自己好水   ......

#include <cstdio>
#include <cstdlib> struct node
{
int x,y;
};
node A,B; node add(node &a,node &b)
{
node f;
f.x = a.x+b.x;
f.y = a.y+b.y;
return f;
} node re(node &a,node &b)
{
node f;
f.x = a.x-b.x;
f.y = a.y-b.y;
return f;
} int cc(node a)
{
return abs(a.x)+abs(a.y);
} int main()
{
int a;
int t = 10;
while(t--)
{
scanf("%d%d%d%d",&A.x,&A.y,&B.x,&B.y);
int flag = 1;
while(flag)
{
flag = 0;
while(cc(add(A, B)) < cc(A))
A = add(A,B), flag = 1;
while(cc(re(A, B)) < cc(A))
A = re(A, B), flag = 1;
while(cc(add(B, A)) < cc(B))
B = add(B, A), flag = 1;
while(cc(re(B, A)) < cc(B))
B = re(B, A), flag = 1;
}
if(cc(A) == 0)
a = cc(B);
else if(cc(B) == 0)
a = cc(A);
else if(cc(A) < cc(B))
a = cc(A);
else
a = cc(B);
printf("%d\n",a);
}
return 0;
}

spoj 62的更多相关文章

  1. SPOJ - PHRASES Relevant Phrases of Annihilation

    传送门:SPOJ - PHRASES(后缀数组+二分) 题意:给你n个字符串,找出一个最长的子串,他必须在每次字符串中都出现至少两次. 题解:被自己蠢哭...记录一下自己憨憨的操作,还一度质疑评测鸡( ...

  2. BZOJ 2588: Spoj 10628. Count on a tree [树上主席树]

    2588: Spoj 10628. Count on a tree Time Limit: 12 Sec  Memory Limit: 128 MBSubmit: 5217  Solved: 1233 ...

  3. VS2015编译boost1.62

    VS2015编译boost1.62 Boost库是一个可移植.提供源代码的C++库,作为标准库的后备,是C++标准化进程的开发引擎之一. Boost库由C++标准委员会库工作组成员发起,其中有些内容有 ...

  4. P87LPC760/61/62/64/67/68/69/78/79芯片解密单片机破解价格

    NXP恩智浦P87LPC760/61/62/64/67/68/69/78/79芯片解密单片机破解 NXP LPC700系列单片机解密型号: P87LPC759.P87LPC760.P87LPC761. ...

  5. SPOJ DQUERY D-query(主席树)

    题目 Source http://www.spoj.com/problems/DQUERY/en/ Description Given a sequence of n numbers a1, a2, ...

  6. SPOJ GSS3 Can you answer these queries III[线段树]

    SPOJ - GSS3 Can you answer these queries III Description You are given a sequence A of N (N <= 50 ...

  7. HDU2089 不要62[数位DP]

    不要62 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submis ...

  8. 【填坑向】spoj COT/bzoj2588 Count on a tree

    这题是学主席树的时候就想写的,,, 但是当时没写(懒) 现在来填坑 = =日常调半天lca(考虑以后背板) 主席树还是蛮好写的,但是代码出现重复,不太好,导致调试的时候心里没底(虽然事实证明主席树部分 ...

  9. Connection broken for id 62, my id = 70, error =

    启动费zokeeper失败,报错如下:Connection broken for id 62, my id = 70, error = 原因是因为zoo.cfg中server.id不正确. serve ...

随机推荐

  1. Cocos2d-x中触摸事件

    理解一个触摸事件可以从时间和空间两方面考虑. 1.触摸事件的时间方面 触摸事件的在时间方面,如下图所示,可以有不同的“按下”.“移动”和“抬起”等阶段,表示触摸是否刚刚开始.是否正在移动或处于静止状态 ...

  2. js(jQuery)获取时间搜集

    获取JavaScript 的时间使用内置的Date函数完成 var mydate = new Date(); mydate.getYear(); //获取当前年份(2位) mydate.getFull ...

  3. c# 简单的通用基础字典

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using Alif.Ali ...

  4. Apache使用mysql认证用户

    使用MySQL进行认证 第1步:下载MySQL认证模块,并更名为mod_auth_mysql.so文件,并保存在apache的modules目录下 第2步:apache要加载此功能模块 LoadMod ...

  5. 第二节 hibernate session介绍以及session常用方法介绍

    原创地址:http://www.cnblogs.com/binyulan/p/5628579.html Session是java应用程序和hibernate框架之间的一个主要接口.它是从持久化服务中剥 ...

  6. FreeMarker-Built-ins for strings

    http://freemarker.org/docs/ref_builtins_string.html Page Contents boolean cap_first capitalize chop_ ...

  7. poj 3046 Ant Counting

    Ant Counting Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 4982   Accepted: 1896 Desc ...

  8. Source Insight 技巧总结

    以下文章转载自网络:http://blog.csdn.net/junjie319/article/details/6910992 http://www.cnblogs.com/bluestorm/ar ...

  9. mapper配置

    一:查询 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC &q ...

  10. DirectSound学习(二)--流式缓冲区

    使用流式缓冲方式播放波形音频文件比较复杂,主要原因是在只有一个缓冲区提供给用户的前提下,这个缓冲区在提供给声卡播放数据的同是还需要用户不断的定时向其中写入数据.要注意从缓冲区这时是一个环形缓冲区,声音 ...