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
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 |
write a c program for print your name .but,your name may be small letter mean print a capital letter or your name may be capital letter mean print a small letter .example \\enter ur name : sankar The name is: SANKAR (or) enter your name:SAnkar The name is:saNKAR
Which of the Following is not defined in string.h? A)strspn() B)strerror() C)memchr() D)strod()
What is difference between structure and union in c?
Explain what are the standard predefined macros?
what is the syallabus of computer science students in group- 1?
size maximum allocated by calloc()
what is pointer
How do you define a string?
What is multidimensional arrays
Is it better to bitshift a value than to multiply by 2?
Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
What is that continue statement??