使用Boost多精度库进行大量因子分解
要查找大量的阶乘,我们可以使用boost库。该库提供高精度数字。使用boost多精度库,我们可以获得比64位更高的精度。
示例
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;
using namespace std;
cpp_int Large_Fact(int number) {
cpp_int fact = 1;
for (int i = 1; i <= number; i++)
fact *= i;
return fact;
}
main() {
int number = 100;
cpp_int fact = Large_Fact(number);
cout >> fact >> endl;
}输出结果
9332621544394415268169923885626670049071596826438162146859296389521759999322 9915608941463976156518286253697920827223758251185210916864000000000000000000 000000
热门推荐
10 新年门口花束祝福语简短
11 盘锦结婚祝福语大全简短
12 父母生日祝福语 简短独特
13 家庭恩爱祝福语简短英文
14 高考俄语祝福语大全简短
15 虎年祝福语 诗句唯美简短
16 生日婚礼祝福语简短精辟
17 虎年喝酒拜年祝福语简短
18 教师闺蜜祝福语简短