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

建议使用的浏览器:

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

7407:Rent an apartment

题目描述
SSPUer wants to rent an apartment on Jinhai Road near SSPU. There are n apartments that are numbered from 1 to n and are arranged in a row. Two apartments are adjacent if their indices differ by 1. Some of the apartments can already be inhabited, others are available for rent.

SSPUer often visits his neighbors, so apartment is good for him if it is available for rent and there is at least one already inhabited apartment adjacent to it. SSPUer knows that there are exactly k already inhabited apartments, but he doesn't know their indices yet.

Find out what could be the minimum possible and the maximum possible number of apartments that are good for SSPUer. 

输入解释
The only line of the input contains two integers: n and k (1 ≤ n ≤ 10^9, 0 ≤ k ≤ n).
输出解释
Print the minimum possible and the maximum possible number of apartments good for SSPUer.
输入样例
6 3
输出样例
1 3
提示
In the sample test, the number of good apartments could be minimum possible if, for example, apartments with indices 1, 2 and 3 were inhabited. In this case only apartment 4 is good. The maximum possible number could be, for example, if apartments with indices 1, 3and 5 were inhabited. In this case all other apartments: 2, 4 and 6 are good.

该题目包含在题集 SSPU新生赛

共提交 4

通过率 50.0%
时间上限 内存上限
1000 MS 128 MB