Mbpp/803

✅ 完美通过 Base: PASS Plus: PASS
测试评估
指标结果
Base 测试PASS
Plus 测试PASS
代码长度390 字符
模型生成的代码 (390 字符)
import math
def is_perfect_square(n: int) -> bool:
    """
    Check whether the given integer is a perfect square.

    A perfect square is an integer that is the square of an integer.
    Negative numbers are not perfect squares.
    """
    if n < 0:
        return False
    # math.isqrt computes the integer floor of the square root
    root = math.isqrt(n)
    return root * root == n
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • 无失败测试