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

建议使用的浏览器:

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

3651:A Simple Problem

题目描述
There's one row of buttons lying on onmylove's laptop keyboard, which are used to input the numbers,just as shown in the picture:



onmylove used to input the numbers with his two specifc fingers,, one is on the left, the other is on the right. In one unit time, onmylove's two fingers can both operate. For each finger, each operation can be one of the following:
1.press on the button just under the finger.
2.move to the left button or the right button.

But there're still some points you should pay attention to:
1. at any time, the left nger should at the left side of the right finger.
2. in one unit of time, only one of these two fingers can press the button under it. Of course, the other
finger can move at this unit of time.

Now you are given a string which consists of only numbers, you are asked to calculate: if onmylove want to input all these numbers, how many time does he need at least? At the every beginning, the left finger is above the button "5" and the right finger is above the button "6".
输入解释
Multiple inputs. For each test case, there is one string at a line. It's promised there're only numbers in the string and the length of it is not more than 100.
输出解释
For each test case, output one number at a line, which represents the least time you need.
输入样例
434
56
57
47
输出样例
5
2
2
3
来自杭电HDUOJ的附加信息
Author onmylove
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3651

最后修改于 2020-10-25T23:05:39+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)