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

建议使用的浏览器:

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

3323:Bloxorz II

题目描述

Have you solved the previous problem yet, my friend? As a kid, little Tom has no much patience at all. He turns to play something which is more interesting. Actually he is inventing his own 'Bloxorz' game. Without such many rules and constraints, the new 'Bloxorz' game, which is invented by little Tom, has an infinite plane with all of its cells being rigid cells. (What? Don't know rigid cells? Go to 'Bloxorz I' for more information.)

With the target cell stably located cell (0,0), your task is to tell little Tom what is the minimum number of moves for the box from the given initial cell to the target cell in this infinite plane.

输入解释

Input contains multiple test cases. Each test case contains one letter and two integers on a single line which describes the initial cell and state of the box. The letter will be either 'U' for stands Up, 'H' for lies down towards increasing y axis or 'V' for lies down towards incresing x axis. The two integers x, y (0 ≤ x, y ≤ 1000000000) is the only one cell that box stands on or the one closer to the origin from the two cells that box lies on.

输出解释

For each test cases output one line with the minimum number of moves, which the box could right stand on the origion cell (0,0).

输入样例
U 0 0
H 0 0
V 1 0
输出样例
0
4
1
提示

The plane is infinite, so you may pass through some cell with negative coodinates if you want to.


picture of the coordinate



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

源链接: POJ-3323

最后修改于 2020-10-29T06:58:36+00:00 由爬虫自动更新

共提交 0

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