2025 AIME II Problem 8

Below is the professionally curated solution for Problem 8 of the 2025 AIME II, from LIVE by Po-Shen Loh. You can also try the full timed exam, view all 2025 AIME II solutions, or check the answer key.

All of the real AMC 8, AMC 10, AMC 12, and AIME problems in our complete solution collection are used with official legal permission of the Mathematical Association of America (MAA).

Concepts:optimizationmoneymodular arithmeticcasework

Difficulty rating: 2990

8.

From an unlimited supply of 11-cent coins, 1010-cent coins, and 2525-cent coins, Silas wants to find a collection of coins that has a total value of NN cents, where NN is a positive integer. He uses the so-called greedy algorithm, successively choosing the coin of greatest value that does not cause the value of his collection to exceed N.N. For example, to get 4242 cents, Silas will choose a 2525-cent coin, then a 1010-cent coin, then 77 11-cent coins. However, this collection of 99 coins uses more coins than necessary to get a total of 4242 cents; indeed, choosing 44 1010-cent coins and 22 11-cent coins achieves the same total value with only 66 coins.

In general, the greedy algorithm succeeds for a given NN if no other collection of 11-cent, 1010-cent, and 2525-cent coins gives a total value of NN cents using strictly fewer coins than the collection given by the greedy algorithm. Find the number of values of NN between 11 and 10001000 inclusive for which the greedy algorithm succeeds.

Solution:

In any optimal collection there are at most 99 pennies (ten pennies could become a dime) and at most 44 dimes (five dimes could become two quarters), so its dimes and pennies are worth at most 4949 cents. Hence an optimal collection uses either q=N/25q = \lfloor N/25 \rfloor quarters, like greedy, or q1q - 1 quarters. For an amount vv made only of dimes and pennies, the best count is f(v)=v/10+(vmod10),f(v) = \lfloor v/10 \rfloor + (v \bmod 10), which is what greedy does on the remainder.

Let r=Nmod25.r = N \bmod 25. Greedy uses q+f(r)q + f(r) coins, and the only rival uses (q1)+f(r+25)(q - 1) + f(r + 25) coins (possible when q1q \ge 1), so greedy fails exactly when f(r+25)f(r).f(r + 25) \le f(r). Tabulating: for r=0,,4,r = 0, \ldots, 4, f(r+25)=r+7>f(r)=r;f(r+25) = r + 7 \gt f(r) = r; for r=5,,9,r = 5, \ldots, 9, f(r+25)=r2r;f(r+25) = r - 2 \le r; for r=10,,14,r = 10, \ldots, 14, f(r+25)=r2>r9;f(r+25) = r - 2 \gt r - 9; for r=15,,19,r = 15, \ldots, 19, f(r+25)=r11r9;f(r+25) = r - 11 \le r - 9; for r=20,,24,r = 20, \ldots, 24, f(r+25)=r11>r18.f(r+25) = r - 11 \gt r - 18. So greedy fails exactly when N25N \ge 25 and r{5,,9}{15,,19}.r \in \{5, \ldots, 9\} \cup \{15, \ldots, 19\}.

Each residue class mod 2525 contains 4040 values of NN in 1,,1000,1, \ldots, 1000, so these 1010 residues give 400400 values, of which the 1010 values less than 2525 do not count (there q=0q = 0). Greedy fails for 390390 values and succeeds for 1000390=610.1000 - 390 = 610.

← Problem 7Full ExamProblem 9

Problem 8 in Other Years