Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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.

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I read/write structures from/to data files?

977


Explain #pragma statements.

1059


how logic is used

1980


How does placing some code lines between the comment symbol help in debugging the code?

1012


write a c program for swapping two strings using pointer

2640


Explain the difference between ++u and u++?

1143


What are the 5 organizational structures?

1033


Is a house a mass structure?

1098


Describe the order of precedence with regards to operators in C.

1051


please explain every phase in the "SDLC" in the dotnet.

2624


What is quick sort in c?

1097


What is meant by type specifiers?

1140


What is an arrays?

1082


What are local static variables? How can you use them?

1154


Is main a keyword in c?

1138