|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
{,1,2,3,5,5,5,5,5,5,6,6,5,2,5,6} / {6,5,4,7,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9};
想破天也想不到
另外,C++不能计算50以上的阶乘?我怎么不知道?
- #include <iostream>
- #include <boost/multiprecision/cpp_int.hpp>
- using number_t = boost::multiprecision::cpp_int;
- number_t factorial(number_t n)
- {
- if(n == 0 || n == 1)
- return 1;
- return n * factorial(n - 1);
- }
- int main()
- {
- std::cout << factorial(50) << std::endl;
- return 0;
- }
复制代码
- 30414093201713378043612608166064768844377641568960512000000000000
复制代码
50的阶乘没意思,让我们看看12345的阶乘 ^_^
- #include <iostream>
- #include <boost/multiprecision/cpp_int.hpp>
- using number_t = boost::multiprecision::cpp_int;
- number_t factorial(number_t n)
- {
- if(n == 0 || n == 1)
- return 1;
- return n * factorial(n - 1);
- }
- int main()
- {
- std::cout << factorial(12345) << std::endl;
- return 0;
- }
复制代码
factorial.12345.zip
(20.19 KB, 下载次数: 0)
我的这台计算机的极限是12345(我指的是不能计算123456,而不是12346)
|
|