I solve it by the help of Steven
Halim's Website. In
that page I found
It's
quite hard to find this rule... however if Stan and Ollie plays
perfect game, then Stan will always try to multiply p with 9 and
Ollie will always try to multiply p with 2..., so just simulate
the process backwards (i.e. from n, you divide by 9, then divide
by 2, by 9... etc until n == 1), then check whose turn can make
n becomes 1 and output the winner name.�
But
I don�t follow this exactly. I solve this by starting from 1
to n (forwardly) and I do not know , how this does work.
|