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
What is pointer & why it is used?
Write a C program linear.c that creates a sequence of
processes with a given length. By
sequence it is meant that each created process has exactly
one child.
Let's look at some example outputs for the program.
Here the entire process sequence consists of process 18181:
Sara@dell:~/OSSS$ ./linear 1
Creating process sequence of length 1.
18181 begins the sequence.
An example for a sequence of length three:
Sara@dell:~/OSSS$ ./linear 3
Creating process sequence of length 3.
18233 begins the sequence.
18234 is child of 18233
18235 is child of 18234
........ this is coad .... BUt i could not compleate it .....:(
#include
When should structures be passed by values or by references?
Is it better to use malloc() or calloc()?
Do you know the purpose of 'register' keyword?
Can we assign integer value to char in c?
Which control loop is recommended if you have to execute set of statements for fixed number of times?
What is difference between arrays and pointers?
how can use subset in c program and give more example
Explain what are linked list?
Differentiate between the = symbol and == symbol?
Explain pointers in c programming?
explain what is fifo?
How do I use strcmp?
please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code