Mbpp/781

✅ 完美通过 Base: PASS Plus: PASS
测试评估
指标结果
Base 测试PASS
Plus 测试PASS
代码长度419 字符
模型生成的代码 (419 字符)
def count_divisors(n: int) -> bool:
    """
    Returns True if the number of positive divisors of n is even, False otherwise.
    """
    if n <= 0:
        raise ValueError("Input must be a positive integer")
    
    # A number has an odd number of divisors if and only if it is a perfect square.
    # Therefore, the count is even when n is NOT a perfect square.
    root = int(n ** 0.5)
    return root * root != n
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • 无失败测试