博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
大数阶乘!
阅读量:4072 次
发布时间:2019-05-25

本文共 634 字,大约阅读时间需要 2 分钟。

#include 
int main(){ int n; scanf("%d",&n); if(n<=2) printf("%d\n",n); else{ int ans[10000],digit = 1;//位数 ans[0]=1; for(int i=2;i<=n;++i){ int c = 0;//进位 for (int j=1; j<=digit; ++j) { c = ans[j-1] * i + c; ans[j-1] = c %10; c = c/10; } while(c) { ++digit; ans[digit-1] = c%10; c = c/10; } } for (int i=digit; i>0; --i) { printf("%d",ans[i-1]); printf(i==1?"\n":""); } } return 0;}

转载地址:http://amhji.baihongyu.com/

你可能感兴趣的文章
xorg.conf的编写
查看>>
启用SELinux时遇到的问题
查看>>
virbr0 虚拟网卡卸载方法
查看>>
No devices detected. Fatal server error: no screens found
查看>>
新版本的linux如何生成xorg.conf
查看>>
virbr0 虚拟网卡卸载方法
查看>>
Centos 6.0_x86-64 终于成功安装官方显卡驱动
查看>>
Linux基础教程:CentOS卸载KDE桌面
查看>>
hd cdnServer 51cdn / ChinaCache / ATS / Apache Traffic Server
查看>>
project web architecture
查看>>
OS + Unix HP-UX
查看>>
OS + Unix Solaris / openSolaris
查看>>
db sql montior
查看>>
Unix + SCO UnixWare
查看>>
db db2 books
查看>>
read humor_campus
查看>>
IBM WebSphere Commerce Analyzer
查看>>
Unix + OS IBM Aix System Director
查看>>
Unix + OS IBM Aix FTP / wu-ftp / proftp
查看>>
my read work
查看>>