返回题库

AIME 2024 I · 第 3 题

AIME 2024 I — Problem 3

专题
Contest Math
难度
L4
来源
AIME

题目详情

Problem

Alice and Bob play the following game. A stack of nn tokens lies before them. The players take turns with Alice going first. On each turn, the player removes either 11 token or 44 tokens from the stack. Whoever removes the last token wins. Find the number of positive integers nn less than or equal to 20242024 for which there exists a strategy for Bob that guarantees that Bob will win the game regardless of Alice's play.

解析

Solution 1

Let's first try some experimentation. Alice obviously wins if there is one coin. She will just take it and win. If there are 2 remaining, then Alice will take one and then Bob will take one, so Bob wins. If there are 33, Alice will take 11, Bob will take one, and Alice will take the final one. If there are 44, Alice will just remove all 44 at once. If there are 55, no matter what Alice does, Bob can take the final coins in one try. Notice that Alice wins if there are 11, 33, or 44 coins left. Bob wins if there are 22 or 55 coins left.

After some thought, you may realize that there is a strategy for Bob. If there is n is a multiple of 55, then Bob will win. The reason for this is the following: Let's say there are a multiple of 55 coins remaining in the stack. If Alice takes 11, Bob will take 44, and there will still be a multiple of 55. If Alice takes 44, Bob will take 11, and there will still be a multiple of 55. This process will continue until you get 00 coins left. For example, let's say there are 205205 coins. No matter what Alice does, Bob can simply just do the complement. After each of them make a turn, there will always be a multiple of 55 left. This will continue until there are 55 coins left, and Bob will end up winning.

After some more experimentation, you'll realize that any number that is congruent to 22 mod 55 will also work. This is because Bob can do the same strategy, and when there are 22 coins left, Alice is forced to take 11 and Bob takes the final coin. For example, let's say there are 7272 coins. If Alice takes 11, Bob will take 44. If Alice takes 44, Bob will take 11. So after they each make a turn, the number will always be equal to 22 mod 55. Eventually, there will be only 22 coins remaining, and we've established that Alice will simply take 11 and Bob will take the final coin.

So we have to find the number of numbers less than or equal to 20242024 that are either congruent to 00 mod 55 or 22 mod 55. There are 404404 numbers in the first category: 5,10,15,,20205, 10, 15, \dots, 2020. For the second category, there are 405405 numbers. 2,7,12,17,,20222, 7, 12, 17, \dots, 2022. So the answer is 404+405=809404 + 405 = \boxed{809}

~lprado

Solution 2

Let's use winning and losing positions, where WW marks a win for Alice.

11 coin: WW

22 coins: LL

33 coins: WW

44 coins: WW

55 coins: LL

66 coin: WW

77 coins: LL

88 coins: WW

99 coins: WW

1010 coins: LL

1111 coin: WW

1212 coins: LL

1313 coins: WW

1414 coins: WW

1515 coins: LL

We can see that losing positions occur when nn is congruent to 0,2mod50, 2 \mod{5} and winning positions occur otherwise. As nn ranges from 11 to 20202020, 25\frac{2}{5} of these values are losing positions where Bob will win. As nn ranges from 20212021 to 20242024, 20222022 is the only value where Bob will win. Thus, the answer is 2020×25+1=8092020\times\frac{2}{5}+1=\boxed{809}

~alexanderruan

Solution 3

Denote by AiA_i and BiB_i Alice's or Bob's iith moves, respectively.

Case 1: n0(mod5)n \equiv 0 \pmod{5}.

Bob can always take the strategy that Bi=5AiB_i = 5 - A_i. This guarantees him to win.

In this case, the number of nn is 20245=404\left\lfloor \frac{2024}{5} \right\rfloor = 404.

Case 2: n1(mod5)n \equiv 1 \pmod{5}.

In this case, consider Alice's following strategy: A1=1A_1 = 1 and Ai=5Bi1A_i = 5 - B_{i-1} for i2i \geq 2. Thus, under Alice's this strategy, Bob has no way to win.

Case 3: n4(mod5)n \equiv 4 \pmod{5}.

In this case, consider Alice's following strategy: A1=4A_1 = 4 and Ai=5Bi1A_i = 5 - B_{i-1} for i2i \geq 2. Thus, under Alice's this strategy, Bob has no way to win.

Case 4: n2(mod5)n \equiv 2 \pmod{5}.

Bob can always take the strategy that Bi=5AiB_i = 5 - A_i. Therefore, after the n5\left\lfloor \frac{n}{5} \right\rfloorth turn, there are two tokens leftover. Therefore, Alice must take 1 in the next turn that leaves the last token on the table. Therefore, Bob can take the last token to win the game. This guarantees him to win.

In this case, the number of nn is 202425+1=405\left\lfloor \frac{2024 - 2}{5} \right\rfloor +1 = 405.

Case 5: n3(mod5)n \equiv 3 \pmod{5}.

Consider Alice's following strategy: A1=1A_1 = 1 and Ai=5Bi1A_i = 5 - B_{i-1} for i2i \geq 2. By doing so, there will finally be 2 tokens on the table and Bob moves first. Because Bob has the only choice of taking 1 token, Alice can take the last token and win the game.

Therefore, in this case, under Alice's this strategy, Bob has no way to win.

Putting all cases together, the answer is 404+405=(809) 404 + 405 = \boxed{\textbf{(809) }}.

Solution 4 (Grundy Values)

Since the game Alice and Bob play is impartial (the only difference between player 1 and player 2 is that player 1 goes first (note that games like chess are not impartial because each player can only move their own pieces)), we can use the Sprague-Grundy Theorem to solve this problem. We will use induction to calculate the Grundy Values for this game.

We claim that heaps of size congruent to 0,2mod50,2 \bmod{5} will be in outcome class P\mathcal{P} (win for player 2 = Bob), and heaps of size equivalent to 1,3,4mod51,3,4 \bmod{5} will be in outcome class N\mathcal{N} (win for player 1 = Alice). Note that the mex (minimal excludant) of a set of nonnegative integers is the least nonnegative integer not in the set. e.g. mex(1,2,3)=0(1, 2, 3) = 0 and mex(0,1,2,4)=3(0, 1, 2, 4) = 3.

heap(0)={}=mex()=0\text{heap}(0) = \{\} = *\text{mex}(\emptyset) = 0 heap(1)={0}=mex(0)=\text{heap}(1) = \{0\} = *\text{mex}(0) = * heap(2)={}=mex(1)=0\text{heap}(2) = \{*\} = *\text{mex}(1) = 0 heap(3)={0}=mex(0)=\text{heap}(3) = \{0\} = *\text{mex}(0) = * heap(4)={0,}=mex(0,1)=2\text{heap}(4) = \{0, *\} = *\text{mex}(0, 1) = *2 heap(5)={,2}=mex(1,2)=0\text{heap}(5) = \{*, *2\} = *\text{mex}(1, 2) = 0 heap(6)={0,0}=mex(0,0)=\text{heap}(6) = \{0, 0\} = *\text{mex}(0, 0) = * heap(7)={,}=mex(1,1)=0\text{heap}(7) = \{*, *\} = *\text{mex}(1, 1) = 0 heap(8)={2,0}=mex(0,2)=\text{heap}(8) = \{*2, 0\} = *\text{mex}(0, 2) = * heap(9)={0,}=mex(0,1)=2\text{heap}(9) = \{0, *\} = *\text{mex}(0, 1) = *2 heap(10)={,2}=mex(1,2)=0\text{heap}(10) = \{*, *2\} = *\text{mex}(1, 2) = 0

We have proven the base case. We will now prove the inductive hypothesis: If n0mod5n \equiv 0 \bmod{5}, heap(n)=0\text{heap}(n) = 0, heap(n+1)=\text{heap}(n+1) = *, heap(n+2)=0\text{heap}(n+2) = 0, heap(n+3)=\text{heap}(n+3) = *, and heap(n+4)=2\text{heap}(n+4) = *2, then heap(n+5)=0\text{heap}(n+5) = 0, heap(n+6)=\text{heap}(n+6) = *, heap(n+7)=0\text{heap}(n+7) = 0, heap(n+8)=\text{heap}(n+8) = *, and heap(n+9)=2\text{heap}(n+9) = *2.

heap(n+5)={heap(n+1),heap(n+4)}={,2}=mex(1,2)=0\text{heap}(n+5) = \{\text{heap}(n+1), \text{heap}(n+4)\} = \{*, *2\} = *\text{mex}(1, 2) = 0 heap(n+6)={heap(n+2),heap(n+5)}={0,0}=mex(0,0)=\text{heap}(n+6) = \{\text{heap}(n+2), \text{heap}(n+5)\} = \{0, 0\} = *\text{mex}(0, 0) = * heap(n+7)={heap(n+3),heap(n+6)}={,}=mex(1,1)=0\text{heap}(n+7) = \{\text{heap}(n+3), \text{heap}(n+6)\} = \{*, *\} = *\text{mex}(1, 1) = 0 heap(n+8)={heap(n+4),heap(n+7)}={2,0}=mex(2,1)=\text{heap}(n+8) = \{\text{heap}(n+4), \text{heap}(n+7)\} = \{*2, 0\} = *\text{mex}(2, 1) = * heap(n+9)={heap(n+5),heap(n+8)}={0,}=mex(0,1)=2\text{heap}(n+9) = \{\text{heap}(n+5), \text{heap}(n+8)\} = \{0, *\} = *\text{mex}(0, 1) = *2

We have proven the inductive hypothesis. QED.

There are 202025=8082020*\frac{2}{5}=808 positive integers congruent to 0,2mod50,2 \bmod{5} between 1 and 2020, and 1 such integer between 2021 and 2024. 808+1=809808 + 1 = \boxed{809}.

~numerophile

Solution 5 (no modular arithmetic)

We start with nn as some of the smaller values. After seeing the first 4 where Bob wins automatically, with trial and error we see that 2,5,7,2, 5, 7, and 1010 are spaced alternating in between 2 and 3 apart. This can also be proven with modular arithmetic, but this is an easier solution for some people. We split them into 2 different sets with common difference 5: {2,7,12 ...} and {5,10,15...}. Counting up all the numbers in each set can be done as follows:

Set 1 2,7,12...{2,7,12...}

20242=20222024-2=2022 (because the first term is two)

20245=404\lfloor \frac{2024}{5} \rfloor = 404

Set 2 5,10,15{5,10,15}

20245=404\lfloor \frac{2024}{5} \rfloor = 404

And because we forgot 2022 we add 1 more.

404+404+1=809404+404+1=809

-Multpi12 (Edits would be appreciated) LaTexed by BossLu99

Video Solution

https://youtu.be/SM4UhX00LMo

~Veer Mahajan

Video Solution

https://youtu.be/maUmj9kQ6pg

~Steven Chen (Professor Chen Education Palace, www.professorchenedu.com)

Video Solution

https://www.youtube.com/watch?v=Z9mwY-4IprM

~Ajeet Dubey (https://www.ioqm.in)