本地成功上传却出错了,0分

P1009 [NOIP1998 普及组] 阶乘之和

silly_boy @ 2022-11-21 20:45:33

#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
    int i,j, n, A[100]={0}, B[100]={0};
    scanf("%d", &n);
    A[0] = 1;
    for (i = 1; i <= n; i++)
    {
        for(j=0;j<100;j++)
        A[j] *= i;
        for(j=0;j<100;j++)
            if (A[j] > 9)
            {
                A[j + 1] = A[j] / 10;
                A[j] %= 10;
            }
        for (j = 0; j < 100; j++)
            B[j] += A[j];
        for (j = 0; j < 100; j++)
            if (B[j] > 9)
            {
                B[j + 1] = B[j] / 10;
                B[j] %= 10;
            }
    }
    for (i = 99; i > 0 && B[i] == 0; i--);
    for (j = i; j >= 0; j--)
        printf("%d", B[j]);
    return 0;
}

by silly_boy @ 2022-11-21 20:45:58

人麻了


|