Mbpp/123

❌ 均未通过 Base: FAIL Plus: FAIL
测试评估
指标结果
Base 测试FAIL
Plus 测试FAIL
代码长度556 字符
模型生成的代码 (556 字符)
def amicable_numbers_sum(limit: int) -> int:
    """
    Sum all amicable numbers from 1 to a specified number (inclusive).
    Two numbers a and b are amicable if the sum of proper divisors of a equals b,
    and the sum of proper divisors of b equals a, with a != b.
    """
    if limit < 2:
        return 0

    # Sieve to compute sum of proper divisors for all numbers up to limit
    sum_div = [0] * (limit + 1)
    for i in range(1, limit // 2 + 1):
        for j in range(i * 2, limit + 1, i):
            sum_div[j] += i

    total = 0
    # Find
Base 失败测试用例
  • [999]
Plus 失败测试用例
  • [10000]