百练:2729:求12以内n的阶乘 2730:求20以内n的阶乘 2731:求10000以内n的阶乘

news/2024/10/17 16:31:47/

2729:求12以内n的阶乘
#include<iostream>
using namespace std;
int main()
{
    int n,sum=1;
    scanf("%d",&n);
    for(int i=1;i<=n;++i)
    sum=sum*i;
    printf("%d",sum);
    return 0;
}
2730:求20以内n的阶乘
#include<iostream>
using namespace std;
int main()
{
    int n;
    unsigned long long sum=1;
    scanf("%d",&n);
    for(int i=1;i<=n;++i)
    sum=sum*i;
    printf("%lld",sum);
    return 0;
}
2731:求10000以内n的阶乘
#include<iostream>
using namespace std;
int str[10000005];
int len=1;
void jiecheng(int *p,int i)
{
    
    for(int j=0;j<len;++j)
    *(p+j) *=i;
    for(int j=0;j<len;++j)
    if(*(p+j)>=10)
    {
        *(p+j+1) +=*(p+j)/10;
        *(p+j)=*(p+j)%10;
    }
   while(p[len]>0)
    {
    p[len+1]=p[len]/10;
    p[len]%=10;
    len++;}
}
int main()
{
    int n;
    str[0]=1;
    scanf("%d",&n);
    for(int i=1;i<=n;++i)
    jiecheng(str,i);
    for(int i=len-1;i>=0;i--)
    printf("%d",str[i]);
    return 0;
}


http://www.ppmy.cn/news/248374.html

相关文章

oracle 27140,ORA-27140 ORA-27300 ORA-27301

查看节点1crs状态 [rootnode1 ~]# /oracle/app/grid/bin/crs_stat -t CRS-0184: Cannot communicate with the CRS daemon. 检查下ocr [rootnode1 bin]# ./ocrcheck PROT-602: Failed to retrieve data from the cluster registry PROC-26: Error while accessing the physical…

2020兰洽会VR全景展馆超千万人线上体验,签约总额2730亿元

万商云集&#xff0c;八方赴会。2020年7月2日-5日&#xff0c;以“深化经贸合作&#xff0c;共促绿色发展”为主题的第26届中国兰州投资贸易洽谈会在甘肃兰州如期举办。在商务部、国家市场监管总局、国务院台办、全国工商联、中国侨联、中国贸促会的大力推动下&#xff0c;此次…

PSP表格

PSP2.1Personal Software Process Stages预估耗时&#xff08;分钟&#xff09;实际耗时&#xff08;分钟&#xff09;Planning计划3060 Estimate 估计这个任务需要多少时间16902730Development开发7201040 Analysis 需求分析 (包括学习新技术)3030 Design Spec 生成设计文档30…

Oracle ASM警告日志错误ORA-00603:ORA-27504: ORA-27300:ORA-27301: ORA-27302:处理

1.监控告警主机ASM磁盘错误&#xff1a; Fri May 03 08:01:01 2019 skgxpvfynet: mtype: 61 process 60277 failed because of a resource problem in the OS. The OS has most likely run out of buffers (rval: 4) Errors in file /oracle/app/grid/diag/asm/asm/ASM1/trace…

Troubleshooting ORA-27154 ORA-27300 ORA-27301 ORA-27302

Troubleshooting ORA-27154 ORA-27300 ORA-27301 ORA-27302 这个错误是操作系统设置的问题&#xff0c;测试过程如下。 [oraclegtlions ~]$ sqlplus "/as sysdba" SQL*Plus: Release 10.2.0.5.0 - Production on Sat Feb 4 23:47:02 2012 Copyright (c) 1982, 2010, …

pycharm中Git常见操作与问题总结

1.问题 Committer identity unknown *** Please tell me who you are. Run git config --global user.email “youexample.com” git config --global user.name “Your Name” to set your account’s default identity. Omit --global to set the identity only in this rep…

ORA-27300,ORA-27301,ORA-27302

运维工程师在一台IBM P750&#xff08;AIX6.1&#xff09;上部署了一套oracle&#xff08;未建库&#xff09;&#xff0c;让我把商用的某库同其做一个DG容灾。我按正常步骤部署了DG。 1.在备库开始日志恢复 alter database recover managed standby database using current l…

Spring标签EL表达式漏洞分析(CVE-2011-2730)

Spring标签EL表达式漏洞分析(CVE-2011-2730) El表达式简介 定义&#xff1a;El表达式简单来说&#xff0c;是用简单的语法访问对象的反射库。 在jsp页面中可以使用el表达式代替<%%>&#xff0c;之间访问java对象。 下面的例子分别使用<%%>和el表达式访问对象&am…