咋回事捏

P1009 [NOIP1998 普及组] 阶乘之和

Eletronic_Monkey @ 2024-10-22 18:39:53

#include<stdio.h>
int main()
{
    unsigned long long n,count=0;
    scanf("%llu",&n);
    unsigned long long sum[n];
    for(int i=0;i<n;i++)
    {
        sum[i]=1;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=1;j<=i;j++)
        {
            sum[i]*=j+1;
        }
    }
    for(int i=0;i<n;i++)
    {
        count+=sum[i];
    }
    printf("%llu",count);
    return 0;
}

by _th_tw_on_ @ 2024-10-22 18:46:57

用高精度


|