Language: C

int main(void)
{
    int n;
    long long as[100000];
    scanf("%d", &n);
 
    long long ans = 1;
    for (int i = 0; i < n; i++)
    {
        scanf("%lld", &as[i]);
    }
 
    for (int i = 0; i < n; i++)
    {
        if (as[i] == 0)
        {
            printf("0\n");
            return 0;
        }
    }
 
        for (int i = 0; i < n; i++)
        {
            if (as[i] > BIG / ans)
            {
                printf("-1\n");
                return 0;
            }
            ans *= as[i];
        }
 
    printf("%lld\n", ans);
 
    return 0;
}
#include <stdio.h>

#define BIG ((long long) 1e18)

int main(void)
{
    int n;
    long long as[100000];
    scanf("%d", &n);

    long long ans = 1;
    for (int i = 0; i < n; i++)
    {
        scanf("%lld", &as[i]);
    }

    for (int i = 0; i < n; i++)
    {
        if (as[i] == 0)
        {
            printf("0\n");
            return 0;
        }
    }

        for (int i = 0; i < n; i++)
        {
            if (as[i] * ans > BIG)
            {
                printf("-1\n");
                return 0;
            }
            ans *= as[i];
        }

    printf("%lld\n", ans);

    return 0;
}
提出情報

Compiler output:
main.c: In function 'main':
main.c:5:5: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    5 |     scanf("%d", &n);
      |     ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int main(void)
main.c:5:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    5 |     scanf("%d", &n);
      |     ^~~~~
main.c:5:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:17:13: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   17 |             printf("0\n");
      |             ^~~~~~
main.c:17:13: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:17:13: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:17:13: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:24:25: error: 'BIG' undeclared (first use in this function)
   24 |             if (as[i] > BIG / ans)
      |                         ^~~
main.c:24:25: note: each undeclared identifier is reported only once for each function it appears in
main.c:26:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   26 |                 printf("-1\n");
      |                 ^~~~~~
main.c:26:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:32:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   32 |     printf("%lld\n", ans);
      |     ^~~~~~
main.c:32:5: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c: At top level:
main.c:40:5: error: redefinition of 'main'
   40 | int main(void)
      |     ^~~~
main.c:1:5: note: previous definition of 'main' with type 'int(void)'
    1 | int main(void)
      |     ^~~~
main.c:75:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
   75 | 提出情報
      | ^~~~~~~~