旧代码 - 高精度阶乘
2013-03-05 09:53
148 查看
#include <stdio.h> int casenum,bit; int buf,res; int answer[9000]; int main() { register int i,j; while (1 == scanf("%d", &casenum)) { bit = answer[0] = 1; for (i=1; i<=casenum; ++i) { res = 0; for (j=0; j<bit; ++j) { buf = answer[j] * i + res; if (1 <= buf) { answer[j] = buf % 100000; res = buf / 100000; } // End of if } // End of for while (res) { answer[bit++] = res % 100000; res /= 100000; } // End of while } // End of for printf("%d", answer[bit-1]); for (i=bit-2; i>=0; --i) { printf("%05d", answer[i]); } printf("\n"); } return 0; }
相关文章推荐
- 高精度重载运算符的C++代码
- 高精度运算-阶乘累积求和
- 2018年全国多校算法寒假训练营练习比赛(第三场)E---进击吧!阶乘(Java代码,另附Java解决大数问题的模板)
- 高精度计算-n的阶乘
- HDU 1042 N!(高精度计算阶乘)
- Java版超大整数阶乘算法代码详解-10,0000级
- 阶乘——高精度求法
- 一句代码计算阶乘(python)
- 用高精度方法计算n! ,并显示n!(阶乘)的值。
- 使用C++的string实现高精度加法运算的实例代码
- 高精度! 模板代码!
- 高精度阶乘
- 大数相加,高精度阶乘,大整数进制转换,大整数判断被小整数整除(JOJ--1029)
- 高精度大数的模板--c++代码
- 阶乘高精度计算
- 中石油-高精度阶乘-java
- HDU1066--高精度求阶乘最后非零位
- 白书练习 高精度阶乘
- windows下PTP高精度计时所参考的一些代码
- POJ 2845 01000001 二进制加法 套用高精度加法运算代码