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

Envío 864

Problema 0x25 - Suma de un subarreglo grande

  • Autor: oigres
  • Fecha: 2020-09-26 05:20:49 UTC (Hace más de 3 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 = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:14:29: error: expected ';' after top level declarator
    print(sums[q]-sums[p-1])
                            ^
                            ;
1 warning and 2 errors generated.

                    
#2
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:14:29: error: expected ';' after top level declarator
    print(sums[q]-sums[p-1])
                            ^
                            ;
1 warning and 2 errors generated.

                    
#3
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:14:29: error: expected ';' after top level declarator
    print(sums[q]-sums[p-1])
                            ^
                            ;
1 warning and 2 errors generated.

                    
#4
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:14:29: error: expected ';' after top level declarator
    print(sums[q]-sums[p-1])
                            ^
                            ;
1 warning and 2 errors generated.

                    
#5
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:14:29: error: expected ';' after top level declarator
    print(sums[q]-sums[p-1])
                            ^
                            ;
1 warning and 2 errors generated.

                    
#6
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:14:29: error: expected ';' after top level declarator
    print(sums[q]-sums[p-1])
                            ^
                            ;
1 warning and 2 errors generated.

                    
#7
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:14:29: error: expected ';' after top level declarator
    print(sums[q]-sums[p-1])
                            ^
                            ;
1 warning and 2 errors generated.

                    
#8
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:14:29: error: expected ';' after top level declarator
    print(sums[q]-sums[p-1])
                            ^
                            ;
1 warning and 2 errors generated.

                    
#9
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:14:29: error: expected ';' after top level declarator
    print(sums[q]-sums[p-1])
                            ^
                            ;
1 warning and 2 errors generated.

                    
#10
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:14:29: error: expected ';' after top level declarator
    print(sums[q]-sums[p-1])
                            ^
                            ;
1 warning and 2 errors generated.

                    
#11
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:14:29: error: expected ';' after top level declarator
    print(sums[q]-sums[p-1])
                            ^
                            ;
1 warning and 2 errors generated.

                    
#12
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:14:29: error: expected ';' after top level declarator
    print(sums[q]-sums[p-1])
                            ^
                            ;
1 warning and 2 errors generated.

                    
#13
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:14:29: error: expected ';' after top level declarator
    print(sums[q]-sums[p-1])
                            ^
                            ;
1 warning and 2 errors generated.

                    
#14
Error de compilación
                      main.c:1:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
n = int(input())
^
main.c:1:5: error: expected expression
n = int(input())
    ^
main.c:14:29: error: expected ';' after top level declarator
    print(sums[q]-sums[p-1])
                            ^
                            ;
1 warning and 2 errors generated.

                    
Puntos totales: 0 / 100

Código

n = int(input())
arr = [int(x) for x in input().split()]
sums = []
sum = 0
for a in arr:
    sum += a
    sums.append(sum)

c = int(input())
for i in range(0,c):
    pq = [int(x) for x in input().split()]
    p = pq[0]
    q = pq[1]
    print(sums[q]-sums[p-1])