There are N egg baskets and the number of eggs in each
basket is a known quantity. Two players take turns to remove
these eggs from the baskets. On each turn, a player must
remove at least one egg, and may remove any number of eggs
provided they all belong to the same basket. The player
picking the last egg(s) wins the game. If you are allowed to
decide who is going to start first, what mathematical
function would you use to decide so that you end up on the
winning side?

Answer Posted / lokesh

if the XOR of all the numbers of eggs is zero than second
player win else first player will win.
(From NIM game(game theory))

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

1519


pierrot's divisor program using c or c++ code

1719


Explain the bubble sort algorithm.

632


What are directives in c?

535


Is c programming hard?

563






c language interview questions & answer

1447


In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?

760


How can you determine the maximum value that a numeric variable can hold?

627


how can i access hard disk address(physical address)? are we access hard disk by using far,near or huge pointer? if yes then please explain.....

1364


Why is it important to memset a variable, immediately after allocating memory to it ?

1544


what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values

1253


What is the use of linkage in c language?

603


How macro execution is faster than function ?

656


Distinguish between actual and formal arguments.

579


in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none

591