https://www.codechef.com/problems/ALBOFACE

can anyone please help me out in this problem what does “games is played optimally by both players” mean? so there are sequence of moves ,each player will make. so how to approach such kind of problems?

suppose N=12 then there are two options for Alice(she starts the game) either she divides N by 2 or 4 so by which no she should divide?

https://csacademy.com/code/5dvlfpgs/

this is my code … (for now pls don’t consider its complexity , only consider logic) .

This is my first query on codechef…do ask if you are not clear. Thanks!!

Optimally means that a player will not make a move if he knows that he will surely loose (unless there is no other possible move). Generally these are solve by determining wining state.

1 Like