以下是用 Python 实现的解决方案: ```python def find_best_time_allocation(a1, a2, a3, b1, b2, b3, c1, c2, c3, d1, d2, d3): max_score = 0 best_allocation = None for x1 in range(a3 + 1): for x2 in range(b3 + 1): for x3 in range(c3 + 1): x4 = 120 - x1 - x2 - x3 if 0 <= x4 <= d3: score = 0 if x1 >= a3: score += 100 elif x1 >= a2: score += 60 elif x1 >= a1: score += 30 if x2 >= b3: score += 100 elif x2 >= b2: score += 60 elif x2 >= b1: score += 30 if x3 >= c3: score += 100 elif x3 >= c2: score += 60 elif x3 >= c1: score += 30 if x4 >= d3: score += 100 elif x4 >= d2: score += 60 elif x4 >= d1: score += 30 if score > max_score: max_score = score best_allocation = (x1, x2, x3, x4) return best_allocation # 测试用例 a1, a2, a3 = 5, 10, 20 b1, b2, b3 = 99, 99, 99 c1, c2, c3 = 121, 121, 121 d1, d2, d3 = 120, 120, 120 print(find_best_time_allocation(a1, a2, a3, b1, b2, b3, c1, c2, c3, d1, d2, d3)) ``` 需要注意的逻辑点: 1. 循环的边界条件要设置合理,避免越界或遗漏情况。 2. 对于得分的计算要准确,根据不同的条件进行正确的加分。 3. 要保证最终的时间分配总和为 120 分钟。 [2025-03-29 14:00:47 | AI写代码神器 | 587点数解答]