█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 3071

Problema 0x25 - Suma de un subarreglo grande

  • Autor: cahermat
  • Fecha: 2021-02-18 22:17:20 UTC (Hace casi 4 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
N = input()
^
main.c:1:5: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
N = input()
    ^
main.c:1:5: error: initializer element is not a compile-time constant
N = input()
    ^~~~~~~
main.c:1:12: error: expected ';' after top level declarator
N = input()
           ^
           ;
2 warnings and 2 errors generated.

                    
#2
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
N = input()
^
main.c:1:5: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
N = input()
    ^
main.c:1:5: error: initializer element is not a compile-time constant
N = input()
    ^~~~~~~
main.c:1:12: error: expected ';' after top level declarator
N = input()
           ^
           ;
2 warnings and 2 errors generated.

                    
#3
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
N = input()
^
main.c:1:5: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
N = input()
    ^
main.c:1:5: error: initializer element is not a compile-time constant
N = input()
    ^~~~~~~
main.c:1:12: error: expected ';' after top level declarator
N = input()
           ^
           ;
2 warnings and 2 errors generated.

                    
#4
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
N = input()
^
main.c:1:5: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
N = input()
    ^
main.c:1:5: error: initializer element is not a compile-time constant
N = input()
    ^~~~~~~
main.c:1:12: error: expected ';' after top level declarator
N = input()
           ^
           ;
2 warnings and 2 errors generated.

                    
#5
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
N = input()
^
main.c:1:5: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
N = input()
    ^
main.c:1:5: error: initializer element is not a compile-time constant
N = input()
    ^~~~~~~
main.c:1:12: error: expected ';' after top level declarator
N = input()
           ^
           ;
2 warnings and 2 errors generated.

                    
#6
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
N = input()
^
main.c:1:5: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
N = input()
    ^
main.c:1:5: error: initializer element is not a compile-time constant
N = input()
    ^~~~~~~
main.c:1:12: error: expected ';' after top level declarator
N = input()
           ^
           ;
2 warnings and 2 errors generated.

                    
#7
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
N = input()
^
main.c:1:5: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
N = input()
    ^
main.c:1:5: error: initializer element is not a compile-time constant
N = input()
    ^~~~~~~
main.c:1:12: error: expected ';' after top level declarator
N = input()
           ^
           ;
2 warnings and 2 errors generated.

                    
#8
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
N = input()
^
main.c:1:5: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
N = input()
    ^
main.c:1:5: error: initializer element is not a compile-time constant
N = input()
    ^~~~~~~
main.c:1:12: error: expected ';' after top level declarator
N = input()
           ^
           ;
2 warnings and 2 errors generated.

                    
#9
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
N = input()
^
main.c:1:5: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
N = input()
    ^
main.c:1:5: error: initializer element is not a compile-time constant
N = input()
    ^~~~~~~
main.c:1:12: error: expected ';' after top level declarator
N = input()
           ^
           ;
2 warnings and 2 errors generated.

                    
#10
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
N = input()
^
main.c:1:5: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
N = input()
    ^
main.c:1:5: error: initializer element is not a compile-time constant
N = input()
    ^~~~~~~
main.c:1:12: error: expected ';' after top level declarator
N = input()
           ^
           ;
2 warnings and 2 errors generated.

                    
#11
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
N = input()
^
main.c:1:5: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
N = input()
    ^
main.c:1:5: error: initializer element is not a compile-time constant
N = input()
    ^~~~~~~
main.c:1:12: error: expected ';' after top level declarator
N = input()
           ^
           ;
2 warnings and 2 errors generated.

                    
#12
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
N = input()
^
main.c:1:5: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
N = input()
    ^
main.c:1:5: error: initializer element is not a compile-time constant
N = input()
    ^~~~~~~
main.c:1:12: error: expected ';' after top level declarator
N = input()
           ^
           ;
2 warnings and 2 errors generated.

                    
#13
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
N = input()
^
main.c:1:5: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
N = input()
    ^
main.c:1:5: error: initializer element is not a compile-time constant
N = input()
    ^~~~~~~
main.c:1:12: error: expected ';' after top level declarator
N = input()
           ^
           ;
2 warnings and 2 errors generated.

                    
#14
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
N = input()
^
main.c:1:5: warning: implicit declaration of function 'input' is invalid in C99 [-Wimplicit-function-declaration]
N = input()
    ^
main.c:1:5: error: initializer element is not a compile-time constant
N = input()
    ^~~~~~~
main.c:1:12: error: expected ';' after top level declarator
N = input()
           ^
           ;
2 warnings and 2 errors generated.

                    
Puntos totales: 0 / 100

Código

N = input()
linea = input()
C = input()

consultas = []

for i in range(0,int(C)):
    con = input()
    consultas.append( [int(x) for x in con.split()])
    
arreglo= [int(x) for x in linea.split()]

for i in consultas:
    suma = 0
    for i in range(i[0],i[1]+1):
        suma = suma + arreglo[i]
    
    print(suma)