hdu1042——N!
来源:互联网 发布:免费换ip软件 编辑:程序博客网 时间:2024/04/30 07:46
N!
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 69704 Accepted Submission(s): 19958
Problem Description
Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N!
Input
One N in one line, process to the end of file.
Output
For each N, output N! in one line.
Sample Input
123
Sample Output
126
算了下N的阶乘,为复习一下期末考试,诶!
#include<iostream>#include<cstdio>using namespace std;void fac(int);int main(){int n;while(scanf("%d",&n)!=EOF){fac(n);printf("\n");}return 0;}inline void fac(int n){long long a[100000];int i,j,c,m=0;a[0]=1;for(i=1;i<=n;i++){c=0;for(j=0;j<=m;j++){a[j]=a[j]*i+c;c=a[j]/10;a[j]%=10;}while(c>0){a[++m]=c%10;c/=10;}}for(i=m;i>=0;i--)printf("%d",a[i]);}
0 0
- hdu1042——N!
- HDU1042——N!
- hdu1042——实现大整数N!
- ACM-大数之N!——hdu1042
- HDU1042 N!
- hdu1042 N!
- N! hdu1042
- hdu1042 N!
- HDU1042--N!
- hdu1042 N!
- HDU1042 N!
- N! HDU1042
- HDU1042---N!
- hdu1042 N!
- HDU1042 N!
- hdu1042 N!
- HDU1042 n!
- hdu1042 - N!
- 关于UITableView的一些细小的知识点总结(持续更新)
- 大数据系列第六课:Spark集群环境搭建
- 【Bash百宝箱】Android源码下载及编译
- 使用Queryable.Join实现多表连接查询
- 模板_网络流
- hdu1042——N!
- 每天一个设计模式: 观察者模式(Observer)
- 演化计算会议
- 比大小 OJ 73
- 关于c语言char*的问题
- 20150108-小失误-中国流-执黑胜
- 案例2产生随机数并运算的程序
- 进程和线程的简单介绍
- 使用vim删除内容