返回题库

AIME 2026 II · 第 14 题

AIME 2026 II — Problem 14

专题
Contest Math
难度
L4
来源
AIME

题目详情

Problem

For integers aa and bb, let ab=aba\circ b = a-b if aa is odd and bb is even, and a+ba+b otherwise. Find the number of sequences a1,a2,a3,,ana_1,a_2,a_3,\dots,a_n of positive integers such that

a1+a2+a3++an=12 and a1a2a3an=0,a_1+a_2+a_3+\dots + a_n = 12\text{ and }a_1\circ a_2\circ a_3\circ\dots\circ a_n = 0, where the operations are performed from left to right; that is, a1a2a3a_1\circ a_2\circ a_3 means (a1a2)a3(a_1\circ a_2)\circ a_3.

解析

Solution 1

Let AA be the sum of all terms added when evaluating the operation, and SS be the sum of all terms subtracted. Every term in the sequence is either added or subtracted, so the total sequence sum is:

A+S=12A + S = 12 The final operation result equals the sum of added terms minus the sum of subtracted terms:

AS=0A - S = 0 We have the system:

{A+S=12AS=0\begin{cases} A + S = 12 \\ A - S = 0 \end{cases} Adding the two equations gives: 2A=12    A=62A = 12 \implies A = 6. We substitute back to get S=6S = 6. Thus, the sum of all subtracted terms in the operation must be exactly 66. Our problem reduces to counting sequences where the total of subtracted terms equals 66. We know for any integers xx and yy, xyx+y(mod2)x - y \equiv x + y \pmod{2}. Subtraction does not change the parity of the result. By induction on the number of terms, the parity of the running operation result before term aka_k is exactly equal to the parity of the sum of all terms before aka_k. This gives a simplified subtraction rule, a term aka_k is subtracted if and only if:

  1. The sum of all terms before aka_k is odd;
  2. aka_k itself is even.

Even terms do not change the parity of the cumulative sum, only odd terms do. This allows us to partition the sequence into "gaps" of even terms between (and before/after) the odd terms, eliminating the need to track running parity for every term. Suppose a sequence has mm odd terms, in order: o1,o2,,omo_1, o_2, \dots, o_m. We split the sequence into m+1m+1 gaps of even terms: G0G_0: Even terms before the first odd term o1o_1; GkG_k: Even terms between oko_k and ok+1o_{k+1} for 1km11 \leq k \leq m-1; GmG_m: Even terms after the last odd term omo_m. All even terms in the sequence fall into exactly one of these gaps. For example, in the sequence [2,1,4,3,6][2, 1, 4, 3, 6]: Odd terms: 1,31, 3, so m=2m=2, Gaps: G0=[2]G_0 = [2], G1=[4]G_1 = [4], G2=[6]G_2 = [6]. The parity of the cumulative sum before gap GkG_k depends only on the number of odd terms we have already passed: Before G0G_0: 00 odd terms     \implies sum parity is even; Before G1G_1: 11 odd term     \implies sum parity is odd; Before G2G_2: 22 odd terms     \implies sum parity is even; In general: Before GkG_k, sum parity is k(mod2)k \pmod{2}. Combined with our subtraction rule, this gives: All even terms in odd-indexed gaps (G1,G3,G5,G_1, G_3, G_5, \dots) are subtracted. All even terms in even-indexed gaps (G0,G2,G4,G_0, G_2, G_4, \dots) are added. Now our counting goal is to count sequences where the sum of even terms in odd-indexed gaps equals 66. We split the total sequence sum into three non-negative parts:

  1. OO: Sum of the odd terms in the sequence
  2. EaddE_{\text{add}}: Sum of even terms in even-indexed gaps (added terms)
  3. EsubE_{\text{sub}}: Sum of even terms in odd-indexed gaps (subtracted terms, which equals 66)

From the total sequence sum:

O+Eadd+Esub=12    O+Eadd=6O + E_{\text{add}} + E_{\text{sub}} = 12 \implies O + E_{\text{add}} = 6 We now find all valid values of OO:

  1. OO is the sum of positive odd terms. Recall that the sum of odd numbers is even if and only if there is an even number of terms, since odd + odd = even, and pairs of odd terms preserve evenness.
  2. EaddE_{\text{add}} is a sum of even terms, so it is even.
  3. O+Eadd=6O + E_{\text{add}} = 6, so OO must be even.
  4. O=0O = 0 is impossible: no odd terms means no odd-indexed gaps, so Esub=06E_{\text{sub}} = 0 \neq 6.
  5. O>6O > 6 is impossible: EaddE_{\text{add}} cannot be negative.

Thus, the only valid values for OO are 2,4,6\boldsymbol{2, 4, 6}. We now count valid sequences for each value of OO, breaking our work into subcases for clarity. We will use two main counting rules for our analysis:

  1. Compositions: A composition of a number is an ordered sum of positive integers. For example, 1+51+5 and 5+15+1 are distinct compositions of 66, since sequence order matters.
  2. Splitting Even Sums Across Gaps: To split an even sum S=2KS = 2K across tt gaps, we allow empty gaps: Let the sum in gap ii be 2ki2k_i, so k1+k2++kt=Kk_1 + k_2 + \dots + k_t = K, which can be counted using the stars and bars method. For a gap with ki=0k_i = 0: exactly 11 way (no terms). For a gap with ki1k_i \geq 1: the number of compositions of 2ki2k_i into positive even terms is 2ki12^{k_i - 1}, since we double each part of a composition of kik_i to get an even composition.

Case 1: Sum of Odd Terms O=6O = 6 Here, Eadd=66=0E_{\text{add}} = 6 - 6 = 0: no even terms in even-indexed gaps. We count:

  1. Number of compositions of 66 into an even number of positive odd terms
  2. Number of ways to split the subtracted sum 66 into the odd-indexed gaps

Subcase 1a: 2 odd terms Compositions of 66 into 2 odd terms: 1+5,3+3,5+11+5, 3+3, 5+1     \implies 33 ways Number of odd-indexed gaps: 11 (G1G_1) Ways to split 66 into 1 gap: 44 ways. To see this, note the even compositions of 6 are [6][6], [2+4][2+4], [4+2][4+2], and [2+2+2][2+2+2], giving exactly 4 ways.

Total: 3×4=123 \times 4 = 12

Subcase 1b: 4 odd terms Compositions of 66 into 4 odd terms: 1+1+1+3,1+1+3+1,1+3+1+1,3+1+1+11+1+1+3, 1+1+3+1, 1+3+1+1, 3+1+1+1     \implies 44 ways Number of odd-indexed gaps: 22 (G1,G3G_1, G_3) Ways to split 66 into 2 gaps: 1212 ways

Total: 4×12=484 \times 12 = 48

Subcase 1c: 6 odd terms Compositions of 66 into 6 odd terms: 1+1+1+1+1+11+1+1+1+1+1     \implies 11 way Number of odd-indexed gaps: 33 (G1,G3,G5G_1, G_3, G_5) Ways to split 66 into 3 gaps: 2525 ways

Total: 1×25=251 \times 25 = 25

Total for Case 11: 12+48+25=8512 + 48 + 25 = 85

Case 2: Sum of Odd Terms O=4O = 4 Here, Eadd=64=2E_{\text{add}} = 6 - 4 = 2: we split 22 extra even terms across even-indexed gaps. We count:

  1. Number of compositions of 44 into an even number of positive odd terms
  2. Number of ways to split the subtracted sum 66 into odd-indexed gaps
  3. Number of ways to split the added sum 22 into even-indexed gaps

Subcase 2a: 2 odd terms Compositions of 44 into 2 odd terms: 1+3,3+11+3, 3+1     \implies 22 ways Odd-indexed gaps: 11     \implies 44 ways to split 66 Even-indexed gaps: 22 (G0,G2G_0, G_2)     \implies 22 ways to split 22

Total: 2×4×2=162 \times 4 \times 2 = 16

Subcase 2b: 4 odd terms Compositions of 44 into 4 odd terms: 1+1+1+11+1+1+1     \implies 11 way Odd-indexed gaps: 22     \implies 1212 ways to split 66 Even-indexed gaps: 33 (G0,G2,G4G_0, G_2, G_4)     \implies 33 ways to split 22

Total: 1×12×3=361 \times 12 \times 3 = 36

Total for Case 22: 16+36=5216 + 36 = 52

Case 3: Sum of Odd Terms O=2O = 2 Here, Eadd=62=4E_{\text{add}} = 6 - 2 = 4: we split 44 extra even terms across even-indexed gaps. It is only possible to have 2 odd terms. Compositions of 22 into 2 odd terms: 1+11+1     \implies 11 way Odd-indexed gaps: 11     \implies 44 ways to split 66 Even-indexed gaps: 22     \implies 55 ways to split 44 More than 22 odd terms is impossible, as the smallest sum of 4 positive odd terms is 1+1+1+1=41+1+1+1=4, which is greater than 22.

Total for Case 33: 1×4×5=201 \times 4 \times 5 = 20

We add the totals from all valid cases:

85+52+20=15785 + 52 + 20 = 157 Hence, the number of valid sequences is 157\boxed{157}.

~Steven Zheng

Solution 2

Since the sum is even, the count of odd numbers is even, let it be 2k2k. We can rewrite the sequence as:

e0,1,e0,2,,e0,c0,o1,e1,1,e1,2,,e1,c1,o2,,o2k,e2k,1,,e2k,c2ke_{0, 1}, e_{0, 2}, \dots, e_{0, c_0}, o_1, e_{1, 1}, e_{1, 2}, \dots, e_{1, c_1}, o_2, \dots, o_{2k}, e_{2k, 1}, \dots, e_{2k, c_{2k}} where o stands for odd and e stands for even. Denote

Si=j=1ciei,jS_i= \sum_{j= 1}^{c_i} e_{i, j} and we can notice that:

0=a1a2a3an=i=12koi+i=02k((1)iSi)0= a_1 \circ a_2 \circ a_3 \circ \dots \circ a_n = \sum_{i= 1}^{2k} o_i+ \sum_{i= 0}^{2k} ((-1)^i S_i) From which we can deduce:

i=1kS2i1=6 and i=12koi6\sum_{i= 1}^{k} S_{2i- 1}= 6 \text{ and }\sum_{i= 1}^{2k} o_i \leq 6 which we see 1k31 \leq k \leq 3, so let's starting counting.

Claim\textbf{Claim}: The number of even sequences summing up to kk is 2k212^{\frac{k}{2}- 1}, this can be proven easily using stars and bars.

We denote AkA_k as under a fixed kk, the count of possible sequences e1,.,e3,.,,e2k1,.e_{1, .}, e_{3, .}, \dots, e_{2k- 1, .} summing up to 66.

Bk,sB_{k, s} as the count of possible sequence o.o_{.} summing up to ss.

Ck,sC_{k, s} as the count of possible sequences e0,.,e2,.,,e2k,.e_{0, .}, e_{2, .}, …, e_{2k, .} summing up to 6s6- s.

Then the sought answer can be expressed as:

k=13Aks2=k3Bk,sCk,s\sum_{k= 1}^{3} A_k \sum_{\frac{s}{2}= k}^{3} B_{k, s}C_{k, s} And we can find each component individually.

First, by stars and bars, Bk,sB_{k, s} is just (s2+k12k1)\binom{\frac{s}{2}+ k- 1}{2k- 1}.

Finding Ck,sC_{k, s} is also simple. When s=6s= 6, Ck,sC_{k, s} is clearly 11. and when s=4s= 4, Ck,sC_{k, s} is always 2k2k, which leaves us with C1,2C_{1, 2}, possible sequences are [[],[2,2]] / [[],[4]] / [[2,2],[]] / [[4],[]][[], [2, 2]]\ / \ [[], [4]]\ / \ [[2, 2], []]\ / \ [[4], []] and [[2],[2]][[2], [2]], so C1,2=5C_{1, 2}= 5.

Lastly, we calculate AkA_k. A1A_1 is simply 231=42^{3- 1}= 4.

There are 2 cases for A2A_2: [S1,S3]=[0,6][S_1, S_3]= [0, 6] or [2,4][2, 4] with their permutations.

For the first case, we have 22 permutations, along with 2312^{3- 1} sequences. For the second case, we also have 22 permutations along with 2212112^{2- 1} \cdot 2^{1- 1} sequences. Summing up:

A2=24+22=12A_2= 2 \cdot 4+ 2 \cdot 2= 12 There are 3 cases for A3A_3: [S1,S3,S5]=[0,0,6],[0,2,4][S_1, S_3, S_5]= [0, 0, 6], [0, 2, 4] or [2,2,2][2, 2, 2] with their permutations.

For the first case, we have 33 permutations, along with 2312^{3- 1} sequences. For the second case, we have 66 permutations along with 2212112^{2- 1} \cdot 2^{1- 1} sequences. For the third case, we have 11 permutations and 11 sequence. Summing up:

A3=34+62+11=25A_3= 3 \cdot 4+ 6 \cdot 2+ 1 \cdot 1= 25 Substituting back and we can finally get our answer:

4(15+22+31)+12(14+31)+25(11)=1574 \cdot (1 \cdot 5+ 2 \cdot 2+ 3 \cdot 1)+ 12 \cdot (1 \cdot 4+ 3 \cdot 1)+ 25 \cdot (1 \cdot 1)= \boxed{157} ~PikaBlaze (feel free to edit)

Solution 3

We begin by analyzing the parity of the partial sums resulting from the operation \circ. Let SkS_k denote the result of the operations on the prefix a1,,aka_1, \dots, a_k. That is, S1=a1S_1 = a_1 and Sk=Sk1akS_k = S_{k-1} \circ a_k for k>1k > 1. The operation is defined as:

xy={xyif x is odd and y is even,x+yotherwise.x \circ y = \begin{cases} x - y & \text{if } x \text{ is odd and } y \text{ is even}, \\ x + y & \text{otherwise}. \end{cases} Observe that in both cases, xyx±yx+y(mod2)x \circ y \equiv x \pm y \equiv x + y \pmod 2. By induction, the parity of the partial result SkS_k is equal to the parity of the sum of the terms:

Ski=1kai(mod2).S_k \equiv \sum_{i=1}^k a_i \pmod 2. This observation is crucial because the condition for subtraction depends on the parity of the previous result.

Specifically, the term aka_k (for k>1k > 1) is subtracted if and only if Sk1S_{k-1} is odd and aka_k is even. In all other cases, aka_k is added.

Since Sk1i=1k1ai(mod2)S_{k-1} \equiv\sum_{i=1}^{k-1} a_i \pmod 2, we can state the rule solely in terms of the sum of the preceding terms: aka_k is subtracted if and only if the sum of the previous terms is odd and aka_k itself is even.

Let PP be the set of indices ii such that aia_i is added, and MM be the set of indices jj such that aja_j is subtracted. The value of the expression is given by:

Sn=iPaijMaj.S_n = \sum_{i \in P} a_i - \sum_{j \in M} a_j. We are given two conditions: the total sum of the integers is i=1nai=12\sum_{i=1}^n a_i = 12, and the result of the operations is Sn=0S_n = 0. Substituting the total sum into the expression for SnS_n:

Sn=(iPai+jMaj)2jMaj=122jMaj.S_n = \left(\sum_{i \in P} a_i + \sum_{j \in M} a_j\right) - 2\sum_{j \in M} a_j = 12 - 2\sum_{j \in M} a_j. Setting Sn=0S_n = 0 yields 122jMaj=012 - 2\sum_{j \in M} a_j = 0, which implies:

jMaj=6.\sum_{j \in M} a_j = 6. Thus, the problem is equivalent to finding the number of sequences of positive integers with a total sum of 12 such that the sum of the subtracted\textbf{subtracted} terms is exactly 6.

We can solve this using dynamic programming. Let N(s,m)N(s, m) be the number of sequences of positive integers with total sum ss where the sum of the subtracted terms is mm. We are interested in finding N(12,6)N(12, 6).

The state transitions depend on whether the current accumulated sum ss is even or odd, as this determines whether the next term will be subtracted.

\begin{array}{|c|c|c|c|} \hline \text{Current Sum } s & \text{Last Term } v & \text{Prev Sum } s-v & \text{Action on } v \\ \hline \text{Even} & \text{Even} & \text{Even} & \text{Add} \\ \text{Even} & \text{Odd} & \text{Odd} & \text{Add} \\ \hline \text{Odd} & \text{Odd} & \text{Even} & \text{Add} \\ \textbf{Odd} & \textbf{Even} & \textbf{Odd} & \textbf{Subtract} \\ \hline \end{array}

Let's derive the recurrence relations for N(s,m)N(s, m) by considering the last term added, say vv. The previous sum was svs-v.

1.1. If the current sum ss is even:

The previous sum svs-v must have the same parity as vv.

\bullet If vv is even, svs-v is even. The previous sum was even, so vv was added (not subtracted).

\bullet If vv is odd, svs-v is odd. An odd term is never subtracted.

In both cases, no subtraction occurred for the last term. Thus:

N(s,m)=v evenN(sv,m)+v oddN(sv,m).N(s, m) = \sum_{v \text{ even}} N(s-v, m) + \sum_{v \text{ odd}} N(s-v, m). 22. If the current sum ss is odd:

The previous sum svs-v must have the opposite parity to vv.

\bullet If vv is odd, svs-v is even. The previous sum was even, so vv was added.

\bullet If vv is even, svs-v is odd. The previous sum was odd and vv is even, so vv was \textbf{subtracted}. The previous subtracted sum must have been mvm-v.

Thus:

N(s,m)=v oddN(sv,m)+v evenN(sv,mv).N(s, m) = \sum_{v \text{ odd}} N(s-v, m) + \sum_{v \text{ even}} N(s-v, m-v). We compute N(s,m)N(s, m) for ss from 1 to 12. The base case is N(0,0)=1N(0, 0) = 1 (the empty sequence). We require N(12,6)N(12, 6).

Performing the calculation step-by-step:

\bullet s=1\mathbf{s=1} (Odd): N(1,0)=N(0,0)=1N(1,0) = N(0,0) = 1.

\bullet s=2\mathbf{s=2} (Even): N(2,0)=N(1,0)(add 1)+N(0,0)(add 2)=1+1=2N(2,0) = N(1,0) (\text{add } 1) + N(0,0) (\text{add } 2) = 1 + 1 = 2.

\bullet s=3\mathbf{s=3} (Odd):

- m=0m=0: Add 1 to N(2,0)N(2,0), add 3 to N(0,0)N(0,0). 2+1=32+1=3.

- m=2m=2: Add 2 (sub) to N(1,0)N(1,0). 11.

N(3,0)=3,N(3,2)=1N(3,0)=3, N(3,2)=1.

\bullet s=4\mathbf{s=4} (Even):

- m=0m=0: Sum all N(s,0)N(s', 0) for s<4s'<4. 3+2+1+1=73+2+1+1 = 7.

- m=2m=2: Sum all N(s,2)N(s', 2) for s<4s'<4. 1+0+0+0=11+0+0+0 = 1.

N(4,0)=7,N(4,2)=1N(4,0)=7, N(4,2)=1.

\bullet s=5\mathbf{s=5} (Odd):

- m=2m=2: Add odd to N(4,2)N(4,2) and N(2,2)N(2,2); add even (sub) to N(3,0)N(3,0).

- vv odd: 11 (from s=4s=4) + 00 (from s=2s=2) = 11.

- vv even: Add 2 (sub) to N(3,0)=3N(3,0)=3. Add 4 (sub) to N(1,)N(1, -).

- Total for m=2m=2: 1+3=41 + 3 = 4.

- m=4m=4: Add 2 (sub) to N(3,2)=1N(3,2)=1. Total 1.

N(5,2)=4,N(5,4)=1N(5,2)=4, N(5,4)=1. (Other m=0m=0 values omitted for brevity).

Continuing this process systematically up to s=12s=12 and m=6m=6:

\bullet At s=12s=12, we sum the contributions to reach a subtracted sum of m=6m=6.

\bullet The total count is found to be exactly 157\boxed{157}.

~ By Jesse Zhang (FUNKCCP)

List of Valid Sequences

The all 157 possible sequences:

111112221, 11111241, 11111421, 1111161, 111211221, 11121141, 111221121, 111222111, 11122212, 1112223, 11124111, 1112412, 111243, 11141121, 11142111, 1114212, 111423, 1116111, 111612, 11163, 11212221, 1121241, 1121421, 112161, 1132221, 113241, 113421, 11361, 121111221, 12111141, 121121121, 121122111, 12112212, 1211223, 12114111, 1211412, 121143, 12121221, 1212141, 1213221, 121341, 122111121, 122112111, 12211212, 1221123, 12212121, 1221321, 122211111, 12221112, 1222113, 12221211, 1222122, 1222131, 122214, 1222311, 122232, 12225, 1223121, 1231221, 123141, 12411111, 1241112, 124113, 1241211, 124122, 124131, 12414, 124311, 12432, 1245, 1312221, 131241, 131421, 13161, 14111121, 14112111, 1411212, 141123, 1412121, 141321, 14211111, 1421112, 142113, 1421211, 142122, 142131, 14214, 142311, 14232, 1425, 143121, 1611111, 161112, 16113, 161211, 16122, 16131, 1614, 16311, 1632, 165, 21112221, 2111241, 2111421, 211161, 21211221, 2121141, 21221121, 21222111, 2122212, 212223, 2124111, 212412, 21243, 2141121, 2142111, 214212, 21423, 216111, 21612, 2163, 2212221, 221241, 221421, 22161, 232221, 23241, 23421, 2361, 3112221, 311241, 311421, 31161, 3211221, 321141, 3221121, 3222111, 322212, 32223, 324111, 32412, 3243, 341121, 342111, 34212, 3423, 36111, 3612, 363, 412221, 41241, 41421, 4161, 52221, 5241, 5421, 561