HDUOJ1042-N!
来源:互联网 发布:模板小偷帝国cms 编辑:程序博客网 时间:2024/06/10 22:47
大数阶乘问题
#include <iostream>#include <cstring>using namespace std;const int MAXN = 40001;int a[MAXN] = {0};void BigFactorial(int m){ int i, j; int carry; int temp; a[MAXN - 1] = 1; for (i = 2; i <= m; i++) { carry = 0; for (j = MAXN - 1; j >= 0; j--) { temp = a[j] * i + carry; a[j] = temp % 10; carry = temp / 10; } } for (i = 0; i < MAXN; i++) { if (a[i]) break; } for ( ; i < MAXN; i++) cout << a[i]; cout << endl; memset(a, 0, sizeof(int) * MAXN);}int main(){ int n; while (cin >> n) BigFactorial(n); return 0;}
0 0
- HDUOJ1042-N!
- N!
- N!
- n
- N
- N!
- N!
- N!
- N!
- n!
- N!
- N!
- N!
- N!
- n
- N!
- N!
- N!
- Mysql数据类型和常用字段总结
- UESTC 1012 (进制转换)(思维)
- Android Service的生命周期
- eclipse + sakai
- Android中AsyncTask基本用法与源码分析(API 23)
- HDUOJ1042-N!
- 深入分析Parquet列式存储格式
- linux下安装Gnuplot
- Pycharm的安装和基本设置
- DevExpress.XtraGrid.Views.Grid.GridView汇总显示3,4个小数
- (嵌入式开发)移植最新uboot
- 极大点问题
- Poj 2229 Sumsets【dp】
- SharePoint2010 IT Professional - Content Deployment