测试评估
| 指标 | 结果 |
|---|---|
| Base 测试 | PASS |
| Plus 测试 | PASS |
| 代码长度 | 633 字符 |
模型生成的代码 (633 字符)
def count_Substrings(s: str) -> int:
"""
Count the number of substrings where the sum of digits equals the length of the substring.
Args:
s: A string consisting of digits.
Returns:
The number of substrings satisfying the condition.
"""
n = len(s)
count = 0
# Iterate over all possible starting points
for i in range(n):
current_sum = 0
# Expand the substring to the right
for j in range(i, n):
current_sum += int(s[j])
length = j - i + 1
if current_sum == length:
count += 1
return count
Base 失败测试用例
- 无失败测试
Plus 失败测试用例
- 无失败测试