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?

Upload a C program to demonstrate the behaviour of the game.

Answers were Sorted based on User's Feedback



There are N egg baskets and the number of eggs in each basket is a known quantity. Two players take..

Answer / venu

condition: First person should win
The logic is:
1.if n== odd
First person will remove all eggs from the basket.
next until empty baskets ==1, First person will just do
what ever the second person do. Once last basket comes he
will remove all eggs.
2.if n== even
First person will take out all eggs except one, 2nd
person forced to loose 1 chance as he will remove that egg.
Now next step is just do the (1)

Is This Answer Correct ?    1 Yes 0 No

There are N egg baskets and the number of eggs in each basket is a known quantity. Two players take..

Answer / guest

does each basket have the same number of eggs?

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More C Interview Questions

What is the difference between char array and char pointer?

0 Answers  


What are file streams?

0 Answers  


What is your stream meaning?

0 Answers  


Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.

0 Answers   Expedia,


How many identifiers are there in c?

0 Answers  






Given a string write a program to print all alphabetical characters in the order of their occurance first,followed by the sum of the numeric characters then followed by the special characters in the order of their occurance.

1 Answers   College School Exams Tests, Wipro,


int main() { int i=1; switch(i) { case '1': printf("hello"); break; case 1: printf("Hi"); break; case 49: printf("Good Morning"); break; } return 0; }

3 Answers  


What is call by value in c?

0 Answers  


what are bitwise shift operators?

4 Answers  


How do I use void main?

0 Answers  


What does == mean in texting?

0 Answers  


please help me.. how to write a code of this output?? "Enter range number:"10 1 is an odd number 2 is an even numbers 3 in an odd numbers 4 " to 10" "printing all odd numbers:" 1,3,5,7,9 "printing all even numbers:" 2,4,6,8,10 "sum of all odd numbers:25 "sum of all even numbers:30 using a C Programming ARRAY pleas pleas help.. its my project ..please :(

1 Answers  


Categories