Problem Description Link
Algorithm
It is a quite hard to find this rule to solve this problem... 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... and so on, so just simulate the process (i.e. for n, you multiply by 9, then multiply by 2, then multiply by 9... etc until p>= n), then check whose turn can make p becomes greater or equal to p and output the winner name.
Algorithm
It is a quite hard to find this rule to solve this problem... 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... and so on, so just simulate the process (i.e. for n, you multiply by 9, then multiply by 2, then multiply by 9... etc until p>= n), then check whose turn can make p becomes greater or equal to p and output the winner name.
No comments:
Post a Comment
Write your comment - Share Knowledge and Experience