测试评估
| 指标 | 结果 |
|---|---|
| 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 失败测试用例
- 无失败测试