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

建议使用的浏览器:

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

5881:Tea

题目描述
Tea is good.

Tea is life.

Tea is everything.

The balance of tea is a journey of pursuing balance of the universe.

Alice knows that.

Alice wants to teach you the art of pouring tea.

Alice has a pot of tea.

The exact volume of tea is not important.

The exact volume of tea is at least $L$.

The exact volume of tea is at most $R$.

Alice put two empty cups between you and her.

Alice wants the two cups filled by almost equal volume of tea.

Yours cannot be $1$ unit more than hers.

Hers cannot be $1$ unit more than yours.

Alice wants you to pour the tea.

Alice wants you to pour until the pot is almost empty.

Alice wants no more than $1$ unit volume of tea remaining in the pot.

You cannot read the residue volume of tea remaining in the pot.

You can only know the tea status in the pot, empty or not.

Alice does not want you to pour the tea too many times.

You better pour as few times as possible.
输入解释
There are multiple cases.
For each case, there is one line of two integers $L$ and $R$, separated by single space.

Here are some analyses about sample cases.
For the first case, pouring $1$ unit into one cup will satisfy Alice.
For the second case, it is clearly that you cannot only pour once to reach the desired balance, but she can achieve it by pouring twice.
First you pour $1.5$ units into one cup, then you attempt to pour another $1.5$ units into the other cup.
Since the lower bound is $2$, at least $0.5$ unit remains in the pot after the first pouring.
If the initial volume is in range $[2, 3]$, the second cup will have volume in range $[0.5, 1.5]$ which is balanced with $1.5$ unit in the first cup, and at most $1$ unit remain after these two attempts.

About $1000$ test cases, and $0 \le L \le R \le 10^{16}$.
输出解释
For each case, there should be a single integer in a single line, the least number of pouring attempts.
输入样例
2 2
2 4
输出样例
1
2
来自杭电HDUOJ的附加信息
Recommend wange2014

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

源链接: HDU-5881

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

共提交 0

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