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

建议使用的浏览器:

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

1525:Euclid's Game

题目描述
Two players, Stan and Ollie, play, starting with two natural numbers. Stan, the first player, subtracts any positive multiple of the lesser of the two numbers from the greater of the two numbers, provided that the resulting number must be nonnegative. Then Ollie, the second player, does the same with the two resulting numbers, then Stan, etc., alternately, until one player is able to subtract a multiple of the lesser number from the greater to reach 0, and thereby wins. For example, the players may start with (25,7):

25 7
11 7
4 7
4 3
1 3
1 0

an Stan wins.

输入解释
The input consists of a number of lines. Each line contains two positive integers giving the starting two numbers of the game. Stan always starts.
输出解释
For each line of input, output one line saying either Stan wins or Ollie wins assuming that both of them play perfectly. The last line of input contains two zeroes and should not be processed.

输入样例
34 12
15 24
0 0
输出样例
Stan wins
Ollie wins
来自杭电HDUOJ的附加信息
Recommend LL

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

源链接: HDU-1525

最后修改于 2020-10-25T22:45:44+00:00 由爬虫自动更新

共提交 359

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