ch42.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:matasano 作者: shainer 项目源码 文件源码
def cube_root(x):
    """Required because the usual x ^ 1/3 does not work with big integers."""
    decimal.getcontext().prec = 2 * len(str(x))
    power = decimal.Decimal(1) / decimal.Decimal(3)
    x = decimal.Decimal(str(x))
    root = x ** power

    integer_root = root.quantize(decimal.Decimal('1.'), rounding=decimal.ROUND_DOWN)
    return int(integer_root)

# Taken from Hal Finney's summary at https://www.ietf.org/mail-archive/web/openpgp/current/msg00999.html,
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号