Wednesday, November 20, 2013

SPOJ 1028. Hubulullu

Here is the problem statement
http://www.spoj.com/problems/HUBULLU/

The words " 2 guys are playing a game"  confuses the reader and sometimes reader thinks that this is a difficult task which is solved with a special game theory techniques. But its not like that. You don't need to know game theories. Let's have a look at a time when one wins. Now let's imagine that after a few moves its the move if the second guy and no matter what move he will make , the first guy will win on the next turn. This means that there must be 2 bunch of numbers (when I am saying bunch I mean one number and all its divisors ). If you look a bit deeper you will find out that the started always can make that position so that no matter what the opponent chooses the advantage is always at the starters side. So we only need to write a few lines of code, if the starter is Airborne output Airborne otherwise output the name of the other guy.

   DOWNLAOD THE FULL SOURCE CODE

       

No comments:

Post a Comment