当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3466:Distance to the Prey

题目描述

Zhizhu is a intelligent spider. His mean of weaving is different from everyone:

His first web was called S0. Then he connected five S0 into a bigger web S1. In the same way he got S2, S3, etc, as the figure above shows. Finally he finished his work S10000!

Today a insect touches the web and gets stuck. The insect is located at (a,b), and Zhizhu is at (c,d). The coordinates are all integers. He wants to know how far he needs to walk in order to reach his prey. Of course, he has to walk along the web S10000.

输入解释

There are multiple test cases. Each case contains one line consisting of 4 integers a, b, c, d (0 ≤ a,b,c,d ≤ 109).

输出解释

For each test case you need to print one number, the distance Zhizhu has to walk.

输入样例
5 3 6 4
输出样例
2
提示

The figure above is one part of S10000. Zhi zhu can walk from (6,4) to (6,3), then (5,3).


该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3466

最后修改于 2020-10-29T07:02:16+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 131072