1 条题解

  • 0
    @ 2024-12-24 10:06:20

    C :

    #include<stdio.h>
    int main()
    {
    	int a,b,c,d;
    	b=0;
    	for(c=1;c<7;c++)
    	{
    		a=1;
    		d=c;
    		while(--d)
    		{
    			a=a*d;
    		}
    		b+=a;
    	}
    	printf("%d\n",b-1);
    	return 0;
    }
    

    C++ :

    #include<iostream>
    #include<cstdio>
    #include<iostream>
    #include<cmath>
    
    using namespace std;
    
    int main(){
        int sum=0,temp=1;
        for(int i=1;i<=5;i++){
            temp *= i;
            sum += temp;
            //cout<<sum<<endl;
        }
        cout<<sum<<endl;
        return 0;
    }
    
    

    Python :

    # coding=utf-8
    def jc(n):
        if n == 1 :
            return 1 
        else:
            return n*jc(n-1)
    s = 0
    for i in range(1,6):
        s += jc(i)
    print(s)
    
    • 1

    信息

    ID
    2701
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者