当前位置:网站首页>求大数的阶乘 ← C语言
求大数的阶乘 ← C语言
2022-06-29 11:33:00 【hnjzsyjyj】
【算法代码】
#include<stdio.h>
#define maxn 10005
int a[maxn]={1};
int len=maxn;
int c=0;
int main() {
int n;
scanf("%d",&n);
int i,j;
for(i=2; i<=n; i++)
for(c=0,j=0; j<len; j++) {
a[j]=a[j]*i+c;
c=a[j]/10;
a[j]%=10;
}
for(i=len-1; a[i]==0; i--); //Get rid of the leading zero
for(j=i; j>=0; j--)
printf("%d",a[j]);
return 0;
}
/*
20
2432902008176640000
*/
【参考文献】
https://blog.csdn.net/lisp1995/article/details/52403507
https://www.csdn.net/tags/NtDaMg4sODU4ODktYmxvZwO0O0OO0O0O.html
边栏推荐
- Wonderful! Miaoying technology fully implements Zadig to help container construction, and fully embraces kubernetes and Yunyuan
- 文件包含之日志中毒(User-Agent)
- Jerry's initiation of ear pairing, reconnection, and opening of discoverable and connectable cycle functions [chapter]
- GBase8s数据库FOR UPDATE 子句
- MATLAB Gui 实现点击按钮,打开文件对话框,导入图片功能
- Engineering practice behind dall-e 2: ensure that the output of the model complies with the content policy
- Weekly recommended short video: How did Einstein think?
- 杰理之关于 TWS 配对方式配置【篇】
- Jerry's configuration of TWS cross pairing [chapter]
- Jerry's about TWS pairing mode configuration [chapter]
猜你喜欢

AutoCAD - text display mode and how CAD can directly open Tianzheng drawings

智能垃圾桶(四)——树莓派pico实现超声波测距(HC-SR04)

嵌入式数据库开发编程(四)——DDL、DML
![Jerry's initiation of ear pairing, reconnection, and opening of discoverable and connectable cycle functions [chapter]](/img/d7/f73e748ada302440326a8b1a46f916.png)
Jerry's initiation of ear pairing, reconnection, and opening of discoverable and connectable cycle functions [chapter]

Jericho's position on initiating the connection back to the opposite ear: 【 chapter 】

大家有没有觉得学机械的人很可怕?

保障饮用水安全!番禺沙湾水道水质在线监测系统通过验收

MATLAB Gui 实现点击按钮,打开文件对话框,导入图片功能

面试突击61:说一下MySQL事务隔离级别?

ERP编制物料清单 华夏
随机推荐
又一所“省会大学”,来了!
杰理之发起对耳配对、回连、开启可发现、可连接的轮循函数【篇】
杰理之关于 TWS 声道配置【篇】
什么是外链和内链?
杰理之关于 TWS 配对方式配置【篇】
Pro test! Centos7 deploy PHP + spool
Zhengda futures liu4 data integration
2022施工员-土建方向-通用基础(施工员)理论题库模拟考试平台操作
面试突击61:说一下MySQL事务隔离级别?
检查YAML文件安全配置:kubesec
Some printer driver PPD files of Lenovo Lingxiang lenovoimage
Oracle expands distributed cloud services to bring comprehensive public cloud services to more customers
Wonderful! Miaoying technology fully implements Zadig to help container construction, and fully embraces kubernetes and Yunyuan
东方财富证券开户安全吗 证券开户办理
GBase8s数据库select有ORDER BY 子句
Unified exception reporting practice based on bytecode
Sofaregistry source code | data synchronization module analysis
AOSP ~ Logcat 持久化
2022胺基化工艺考试题模拟考试题库及在线模拟考试
龙书虎书鲸书啃不动?试试豆瓣评分9.5的猴书