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

建议使用的浏览器:

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

1440:Varacious Steve

题目描述
Steve and Digit bought a box containing a number of donuts. In order to divide them between themselves they play a special game that they created. The players alternately take a certain, positive number of donuts from the box, but no more than some fixed integer. Each player's donuts are gathered on the player's side. The player that empties the box eats his donuts while the other one puts his donuts back into the box and the game continues with the "looser" player starting. The game goes on until all the donuts are eaten. The goal of the game is to eat the most donuts. How many donuts can Steve, who starts the game, count on, assuming the best strategy for both players?

Write a program that:

  • reads the parameters of the game from the standard input,

  • computes the number of donuts Steve can count on,

  • writes the result to the standard output.
输入解释
The rst and only line of the input contains exactly two integers n and m separated by a single space, 1 <= m <= n <= 100 - the parameters of the game, where n is the number of donuts in the box at the beginning of the game and m is the upper limit on the number of donuts to be taken by one player in one move.

Process to the end of file.
输出解释
The output contains exactly one integer equal to the number of donuts Steve can count on.
输入样例
5 2
输出样例
3

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

题目来源 Central Europe 2002

源链接: POJ-1440

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

共提交 0

通过率 --%
时间上限 内存上限
3000 10000