大数阶乘
来源:互联网 发布:awscli json 编辑:程序博客网 时间:2024/04/28 18:09
大数阶乘
Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N!
One N in one line, process to the end of file.
For each N, output N! in one line.
#include<stdio.h>#include<string.h>const int MAX=10005,M=100000000;long long a[MAX];int main(){int n,g,k,b,c;while(scanf("%d",&g)!=EOF){b=0;memset(a,0,sizeof(a));a[0]=1;for(int i=1;i<=g;i++){for(c=k=0;k<=b;k++)a[k]=i*a[k]+c,c=a[k]/M,a[k]%=M;b=k-(c&&(a[k]=c)?0:1);}printf("%lld",a[b]);while(b--)printf("%0.8lld",a[b]);printf("\n");}return 0;}
0 0
- 大数阶乘
- 大数阶乘。
- 大数阶乘
- ~阶乘~大数
- 大数阶乘
- 大数阶乘
- 大数阶乘
- 大数阶乘
- 大数阶乘
- 大数阶乘
- 大数阶乘
- 大数阶乘
- 大数阶乘
- 大数阶乘
- 大数阶乘!!
- 大数阶乘
- 大数阶乘
- 大数阶乘
- 如何对apk文件进行签名
- 初学者——从NN到RNN,深刻理解以softmax为激活函数的反向传播,有代码
- Linux安装各种软件指导书
- 常用名词总结
- Leetcode232. Implement Queue using Stacks
- 大数阶乘
- 导出pdf问题
- web.xml配置详解
- HTML基础
- App测试和传统软件测试有哪些区别?应该增加哪些方面的测试用例?
- 相机拍照或者从本地获取图片上传服务器,并放到imageview上
- aapt停止工作的解决方式之一(记录犯过的错)
- 如何查看ubuntu的内核版本和发行版本号?
- React Native学习指南