Please point me in the question.
The following:
This question is the first question to multiply, considering who can be greater than or equal to n first. I don't think it's easy to find a balance like the Nim game for this kind of topic. In terms of winning and losing, we are turning into a problem to find the scope that everyone will be able to reach. First, for the initiator, 2~9 for the winning interval, regardless of the tempo, the minimum value that can be reached is 18, so the winning range is 10~18. Then and so on, each time in the consideration of the threshold value of each person is to hope that they can be bigger, and the opponent is the hope of smaller, two people to consider separately, so according to their own every time by 9, the opponent to consider the critical interval.
Therefore, the following results are consistent with the conclusion:
1~9->stan;
10~18=2*9->ollie;
19~162=9*2*9->stan;
163~324=2*9*2*9->ollie;
...
Code implementation:
#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#define LL Long Longusing namespace STD; LL N; LL range;intMain () { while(Cin>>n) {range =1;intFlag =1; while(Range < N) {if(flag) {Range *=9; Flag =0; }Else{Range *=2; Flag =1; } }if(!flag) {cout<<"Stan wins."<<endl; }Else{cout<<"Ollie wins."<<endl; } }return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
poj_2505 A Multiplication Game (game, Range)