求助第三个第四个wa

P1009 [NOIP1998 普及组] 阶乘之和

abundan @ 2023-10-04 20:03:09

#include <stdio.h>
int f(int x){
    if(x==1)
    return 1;
    else
    return x*f(x-1);
}
int main() {
    int x,y=0;
    scanf("%d",&x);
    for(int i=1;i<=x;i++){
        y+=f(i);
    }
    printf("%d",y); 
    return 0;
}

by wangjingxiang2007 @ 2023-10-04 20:42:44

没开long long


by PF_anyone @ 2023-10-05 00:13:00

太大爆炸了


by flyWang @ 2023-10-05 20:00:20

@abundon 这道题考的就是高精度加乘,你没用,开了longlong第四个也wa


by fengyongrui @ 2023-10-12 20:08:08

n<=50

别说long long,__int128都不行


|