How can you erase who you have chatted with in the past?

Mathematical Puzzles: A & B erase lines from an array of N lines, taking turns. If A begins erasing lines, what strategy must he/she adopt in order to ensure that he/she does not have to erase the last set of lines?

  • A must erase at least [math]a_0[/math] lines but no more than [math]a_1[/math] lines at a time while B must erase at least [math]b_0[/math] lines but no more than [math]b_1[/math] lines at a time. It appears that A must erase [math](N - b_0)[/math]mod[math](b_1 + a_0)[/math] lines first and subsequently, if B erases [math]x[/math] lines, A must erase [math]b_1 + a_0 - x[/math] lines. And that this will work only if [math]a_1 - a_0 > b_1 - b_0[/math]. Is this correct? If yes, how can you prove it? If not, what is the solution? [math]a_1, b_1[/math] are sufficiently smaller than N.

  • Answer:

    A a reader I hate exercise! I am looking for answers to educate myself not more questions....

Marcus Davidsson at Quora Visit the source

Was this solution helpful to you?

Other answers

The proof follows quite easily from the observation that whenever A plays, A should strive to leave [math]b_0[/math]mod[math](b_1 + a_0)[/math] lines in the array. Let's call this the b1a0-post-condition. This ensures that there will come a time when only [math]b_0[/math] lines will be left and B will be forced to erase them all. Lemmas to be proved, left as an exercise for the reader: If on the first step, A erases [math](N - b_0)[/math]mod[math](b_1 + a_0)[/math] then the A-post-condition is satisfied If the b1a0-post-condition is satisfied, and B erases [math]x[/math], then for any [math]x[/math] the b1a0-post-condition is no longer satisfied. At this point when A erases [math]b_1 + a_0 - x[/math] the b1a0-post-condition is satisfied. At any point, if b1a0-post-condition is satisfied, B can never erase enough lines so that less than or equal to [math]a_0[/math] lines are left and A is forced to pick them all up. For extra credit: Figure out what happens if [math]N = b_0 mod (b_1 + a_0)[/math]. What are the conditions under which A can still guarantee a win? Also, please, just reframe this question in terms of [math]N[/math] coins on a table, and A and B taking turns to pick up some number of coins. It's much easier to explain and reason about. Don't get unnecessarily nerdy.

Navin Kabra

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.