C语言50分求助大佬

P1009 [NOIP1998 普及组] 阶乘之和

EkSulfur @ 2023-08-15 14:48:28

#include <stdio.h>
long long jc(long long x);

int main (void) {
    long long n;
    unsigned long long s=0;
    scanf("%lld", &n);
    for (int i = 1; i < n + 1; i++)
        s += jc(i);
    printf("%llu", s);

    return 0;
}

long long jc(long long x) {
    long long a = 1;
    for (long long j = 1; j <= x; j++)
        a *= j;

    return a;
}

by Happy_Doggie @ 2023-08-15 14:49:13

高精作


by zifan2 @ 2023-08-15 14:57:02

这道题的算法标签是 数学+高精度 .


by 202240210226a @ 2023-08-21 16:27:54

我也是这样的,兄弟。


|