gpt4 book ai didi

c++ - 处理大量

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:22:55 25 4
gpt4 key购买 nike

这是 Problem 3来自 Project Euler 网站

我并没有想出解决方案,但我想您可能会知道我的方法是什么。现在我的问题是,如何处理超过 unsigned int 的数字?

是否有解决此问题的数学方法?如果有,我可以在哪里阅读?

最佳答案

您是否尝试过 unsigned long long 或更好/特别是 uint64_t

如果你想处理大于 uint64_t [264-1] [64 位整数,无符号] 范围的数字,那么你应该查看 bignum : http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic .

600,851,475,143 是问题给出的数字,264-1 等于 18,446,744,073,709,551,615。绝对够大。

关于c++ - 处理大量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2890811/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com