测试评估
| 指标 | 结果 |
|---|---|
| Base 测试 | PASS |
| Plus 测试 | PASS |
| 代码长度 | 418 字符 |
模型生成的代码 (418 字符)
def is_woodall(num: int) -> bool:
"""
Check if a given integer is a Woodall number.
Woodall numbers are of the form: W_n = n * 2^n - 1 for n >= 1.
"""
if num < 1:
return False
n = 1
while True:
woodall = n * (1 << n) - 1 # efficiently calculate n * 2^n - 1
if woodall == num:
return True
if woodall > num:
return False
n += 1
Base 失败测试用例
- 无失败测试
Plus 失败测试用例
- 无失败测试