大数阶乘
来源:互联网 发布:javascript 15天写好的 编辑:程序博客网 时间:2024/06/05 05:33
#include <stdio.h>#include<iostream>using namespace std;int main(){ int carry,n,j; int a[40001]; int digit; int temp,i; while(scanf("%d",&n)!=EOF){ a[0]=1;digit=1; for(i=2; i<=n; i++) { for(carry=0,j=1; j<=digit; ++j) { // cout<<a[j-1 ]<<" "<<i<<endl; temp=a[j-1]*i+carry; // cout<<"temp "<<temp<<endl; a[j-1]=temp%10; // cout<<"a[j-1] "<<a[j-1]<<endl; carry=temp/10; // cout<<"carry "<<carry<<endl; } while(carry) { //digit++; a[++digit-1]=carry%10; carry/=10; } } for(int k=digit; k>=1; --k) printf("%d",a[k-1]); printf("\n"); //printf("length=%d\n",digit); } return 0;}
0 0
- 大数阶乘
- 大数阶乘。
- 大数阶乘
- ~阶乘~大数
- 大数阶乘
- 大数阶乘
- 大数阶乘
- 大数阶乘
- 大数阶乘
- 大数阶乘
- 大数阶乘
- 大数阶乘
- 大数阶乘
- 大数阶乘
- 大数阶乘!!
- 大数阶乘
- 大数阶乘
- 大数阶乘
- Spring+SpringMVC+Mybatis整合系列(三)SSM框架整合
- JavaScript 内置对象创建及用法
- 基于《Selenium 2自动化测试实战》的学习笔记(2)—— 适合自动化测试的项目及自动化测试工具简介
- ElasticSearch5.3.2+LogStash+Kibana+Redis日志管理平台搭建
- 连续子数组的最大和
- 大数阶乘
- LINUX下搭建TOMCAT和MYSQL运行环境
- tensorflow 出现的奇怪错误
- 561. Array Partition I
- 算法设计作业11
- poj 2299 Ultra-QuickSort
- MySQL 半同步复制数据一致性分析
- hadoop,大数据面试都会问哪些问题
- 二分法的变种