Reprinted please indicate the source, thank youHttp://blog.csdn.net/ACM_cxlove? Viewmode = Contents
By --- cxlove
Give two numbers, A and B. Subtract the multiples of several bits from the large number, and the number will win if it is 0.
Http://acm.hdu.edu.cn/showproblem.php? PID = 1, 1525
Two numbers A and B always have a situation of B, A % B, which is inevitable. If a> = B & A <2 * B, then there is only one case, directly to B, A % B. Otherwise, there are multiple cases.
For A/B = 1, only B, A % B can be selected. If a/B> = 2, you can first select who will face the situation like B and A % B.
Obviously, players are smart enough. B. It is clear who wins and loses B. First-hand players must win in a/B> = 2.
# Include <iostream> # include <cstdio> # include <cstring> # include <algorithm> # include <cmath> # include <vector> # include <string> # include <map> # define ll long # define n 1000000 # define INF 1 <20 using namespace STD; int main () {int A, B; while (scanf ("% d", & A, & B )! = EOF & A + B) {if (a <B) Swap (a, B); bool Stan = true; while (1) {If (B = 0 | A % B = 0 | A/B> = 2) break; int T = A; A = B; B = T-A; Stan =! Stan;} If (Stan) printf ("Stan wins \ n"); elseprintf ("Ollie wins \ n");} return 0 ;}