Mbpp/739

⚠️ 仅 Base 通过 Base: PASS Plus: FAIL
测试评估
指标结果
Base 测试PASS
Plus 测试FAIL
代码长度560 字符
模型生成的代码 (560 字符)
import math
def find_Index(n: int) -> int:
    """
    Returns the index k of the smallest triangular number T_k = k*(k+1)//2
    that has exactly n digits (or at least n digits? Actually "with n digits" implies the smallest triangular number whose number of digits is n).
    The smallest k such that T_k >= 10^(n-1).
    """
    if n <= 0:
        raise ValueError("n must be a positive integer")
    target = 2 * 10**(n - 1)
    k = math.isqrt(target)
    # Adjust k if k*(k+1) is smaller than target
    if k * (k + 1) < target:
        k += 1
    return k
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • [100]