Ten empty boxes are arranged in a row, and there are eight balls. The balls are to be placed into the boxes so that no boxes are left unused, the total number of balls is , and each box contains at most two balls. (The balls are indistinguishable.) Find the number of such distributions that satisfy the following conditions. [4 points]\begin{center}\fbox{\begin{minipage}{0.9\textwidth}(A) The number of boxes containing exactly one ball is either or .(B) Any box containing two balls has empty neighboring boxes.\end{minipage}}\end{center}\
[THOUGHT] I will brute-force all possible assignments of 0,1,2 balls to the 10 boxes, filter those with total balls = 8, then apply conditions:
- A: number of boxes with exactly 1 ball is either 4 or 6.
- B: any box with 2 balls must have neighbors (if they exist) equal to 0. I will count how many such assignments there are using Python. [/THOUGHT] [PYTHON] import itertools
count = 0 valid_configs = []
for config in itertools.product([0,1,2], repeat=10): if sum(config) != 8: continue ones = config.count(1) if ones not in (4,6): continue ok = True for i, x in enumerate(config): if x == 2: if i > 0 and config[i-1] != 0: ok = False break if i < 9 and config[i+1] != 0: ok = False break if ok: count += 1 valid_configs.append(config)
print(count)
[THOUGHT] Using brute-force enumeration and applying all given constraints, the number of valid distributions is 262. \boxed{262}