SarthakKeshari / CPP-Questions-and-Solutions

This repository aims to solve and create new problems from different spheres of coding. A path to help students to get access to solutions and discuss their doubts.
MIT License
47 stars 132 forks source link

alice vs bob faceoff #357

Closed satkar2001 closed 2 years ago

satkar2001 commented 2 years ago

Enter your question -

Alice and Bob have got an integer N. They decide to play a game. Alice and Bob make alternating moves: Alice makes the first move, Bob makes the second move, Alice makes the third one, and so on. The game continues until N becomes 0. The player who is unable to make a move loses. During each turn a player can make one of the following moves: Choose an integer X such that X can be expressed as 2Y, Y≥1. The chosen X must also be a factor of N. After choosing an integer X which satisfies the mentioned criteria, the player will divide N by X. If Move 1 is not possible , the player will subtract 1 from N. Predict the winner of the game if the game is played optimally by both the players.

Enter link to the question(if question belongs to any online platform) -

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

PROBLEM FROM CODECHEF

SarthakKeshari commented 2 years ago

@satkar2001, Kindly add your solution to "codechef" folder. Deadline - 08/10/2021