Horray :) :) ... I am so happy this is my first 500 to solve on my own :) :)
Here is a link to the problem statement.
My solution is greedy and it depends on the following observations:
C. Your losing state is when you hit an integer N that there is no primes in the K integers smaller than it.
D. Letting L to be your smallest losing state. If N is smaller than L you will always win. If N is equal of bigger than it you will always lose.(because you can,t reach from L or any integer bigger than it any prime smaller than it)
E. The strategy if you are winning
Here is a link to the problem statement.
My solution is greedy and it depends on the following observations:
A. If the N < 3 the result is 0 because you can't make a move after that.
B. N=3 is your only winning state because any other prime you choose bigger than 3 the other player can remove one from it without hitting another prime.C. Your losing state is when you hit an integer N that there is no primes in the K integers smaller than it.
D. Letting L to be your smallest losing state. If N is smaller than L you will always win. If N is equal of bigger than it you will always lose.(because you can,t reach from L or any integer bigger than it any prime smaller than it)
E. The strategy if you are winning
- Go to 3 if you can.
- else go to smallest prime you can // to speed the game up
- the other player will always go the next integer // to try to make it take as much as possible
- try to go to the nearest prime // to slow the game down
- try to find any integer within range that is a losing state
- if not go to the smallest integer you can
No comments:
Post a Comment