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

Envío 4275

Problema 0x25 - Suma de un subarreglo grande

  • Autor: arturor72
  • Fecha: 2021-06-04 21:36:38 UTC (Hace casi 3 años)
Caso # Resultado Tiempo Memoria
#1
Correcto
                      main.c:3:3: warning: implicitly declaring library function 'scanf' with type 'int (const char *restrict, ...)' [-Wimplicit-function-declaration]
  scanf("%d", &n);
  ^
main.c:3:3: note: include the header <stdio.h> or explicitly provide a declaration for 'scanf'
main.c:17:7: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration]
      printf("%d\n",c);
      ^
main.c:17:7: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
2 warnings generated.

                    
0.004 s 61 KBi
#2
Correcto
                      main.c:3:3: warning: implicitly declaring library function 'scanf' with type 'int (const char *restrict, ...)' [-Wimplicit-function-declaration]
  scanf("%d", &n);
  ^
main.c:3:3: note: include the header <stdio.h> or explicitly provide a declaration for 'scanf'
main.c:17:7: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration]
      printf("%d\n",c);
      ^
main.c:17:7: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
2 warnings generated.

                    
0.003 s 7 KBi
#3
Correcto
                      main.c:3:3: warning: implicitly declaring library function 'scanf' with type 'int (const char *restrict, ...)' [-Wimplicit-function-declaration]
  scanf("%d", &n);
  ^
main.c:3:3: note: include the header <stdio.h> or explicitly provide a declaration for 'scanf'
main.c:17:7: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration]
      printf("%d\n",c);
      ^
main.c:17:7: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
2 warnings generated.

                    
0.003 s 4 KBi
#4
Correcto
                      main.c:3:3: warning: implicitly declaring library function 'scanf' with type 'int (const char *restrict, ...)' [-Wimplicit-function-declaration]
  scanf("%d", &n);
  ^
main.c:3:3: note: include the header <stdio.h> or explicitly provide a declaration for 'scanf'
main.c:17:7: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration]
      printf("%d\n",c);
      ^
main.c:17:7: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
2 warnings generated.

                    
0.004 s 28 KBi
#5
Correcto
                      main.c:3:3: warning: implicitly declaring library function 'scanf' with type 'int (const char *restrict, ...)' [-Wimplicit-function-declaration]
  scanf("%d", &n);
  ^
main.c:3:3: note: include the header <stdio.h> or explicitly provide a declaration for 'scanf'
main.c:17:7: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration]
      printf("%d\n",c);
      ^
main.c:17:7: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
2 warnings generated.

                    
0.003 s 6 KBi
#6
Correcto
                      main.c:3:3: warning: implicitly declaring library function 'scanf' with type 'int (const char *restrict, ...)' [-Wimplicit-function-declaration]
  scanf("%d", &n);
  ^
main.c:3:3: note: include the header <stdio.h> or explicitly provide a declaration for 'scanf'
main.c:17:7: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration]
      printf("%d\n",c);
      ^
main.c:17:7: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
2 warnings generated.

                    
0.002 s 0 KBi
#7
Correcto
                      main.c:3:3: warning: implicitly declaring library function 'scanf' with type 'int (const char *restrict, ...)' [-Wimplicit-function-declaration]
  scanf("%d", &n);
  ^
main.c:3:3: note: include the header <stdio.h> or explicitly provide a declaration for 'scanf'
main.c:17:7: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration]
      printf("%d\n",c);
      ^
main.c:17:7: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
2 warnings generated.

                    
0.003 s 6 KBi
#8
Correcto
                      main.c:3:3: warning: implicitly declaring library function 'scanf' with type 'int (const char *restrict, ...)' [-Wimplicit-function-declaration]
  scanf("%d", &n);
  ^
main.c:3:3: note: include the header <stdio.h> or explicitly provide a declaration for 'scanf'
main.c:17:7: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration]
      printf("%d\n",c);
      ^
main.c:17:7: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
2 warnings generated.

                    
0.296 s 1 KBi
#9
Tiempo límite excedido
                      main.c:3:3: warning: implicitly declaring library function 'scanf' with type 'int (const char *restrict, ...)' [-Wimplicit-function-declaration]
  scanf("%d", &n);
  ^
main.c:3:3: note: include the header <stdio.h> or explicitly provide a declaration for 'scanf'
main.c:17:7: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration]
      printf("%d\n",c);
      ^
main.c:17:7: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
2 warnings generated.

                    
1.044 s 1 KBi
#10
Tiempo límite excedido
                      main.c:3:3: warning: implicitly declaring library function 'scanf' with type 'int (const char *restrict, ...)' [-Wimplicit-function-declaration]
  scanf("%d", &n);
  ^
main.c:3:3: note: include the header <stdio.h> or explicitly provide a declaration for 'scanf'
main.c:17:7: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration]
      printf("%d\n",c);
      ^
main.c:17:7: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
2 warnings generated.

                    
1.063 s 3 KBi
#11
Tiempo límite excedido
                      main.c:3:3: warning: implicitly declaring library function 'scanf' with type 'int (const char *restrict, ...)' [-Wimplicit-function-declaration]
  scanf("%d", &n);
  ^
main.c:3:3: note: include the header <stdio.h> or explicitly provide a declaration for 'scanf'
main.c:17:7: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration]
      printf("%d\n",c);
      ^
main.c:17:7: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
2 warnings generated.

                    
1.042 s 1 KBi
#12
Tiempo límite excedido
                      main.c:3:3: warning: implicitly declaring library function 'scanf' with type 'int (const char *restrict, ...)' [-Wimplicit-function-declaration]
  scanf("%d", &n);
  ^
main.c:3:3: note: include the header <stdio.h> or explicitly provide a declaration for 'scanf'
main.c:17:7: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration]
      printf("%d\n",c);
      ^
main.c:17:7: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
2 warnings generated.

                    
1.059 s 5 KBi
#13
Correcto
                      main.c:3:3: warning: implicitly declaring library function 'scanf' with type 'int (const char *restrict, ...)' [-Wimplicit-function-declaration]
  scanf("%d", &n);
  ^
main.c:3:3: note: include the header <stdio.h> or explicitly provide a declaration for 'scanf'
main.c:17:7: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration]
      printf("%d\n",c);
      ^
main.c:17:7: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
2 warnings generated.

                    
0.025 s 1 KBi
#14
Tiempo límite excedido
                      main.c:3:3: warning: implicitly declaring library function 'scanf' with type 'int (const char *restrict, ...)' [-Wimplicit-function-declaration]
  scanf("%d", &n);
  ^
main.c:3:3: note: include the header <stdio.h> or explicitly provide a declaration for 'scanf'
main.c:17:7: warning: implicitly declaring library function 'printf' with type 'int (const char *, ...)' [-Wimplicit-function-declaration]
      printf("%d\n",c);
      ^
main.c:17:7: note: include the header <stdio.h> or explicitly provide a declaration for 'printf'
2 warnings generated.

                    
1.058 s 56 KBi
Puntos totales: 65 / 100

Código

int main(){
  int n;
  scanf("%d", &n);
  int arr[n];
  int i=0;
  for(i=0; i<n; i++){
    scanf("%d", &arr[i]);
   }
  int consultas;
  scanf("%d", &consultas);
  
  for(i=0; i<consultas; i++){
     int p,q;
     scanf("%d %d", &p, &q);
     int c=0;
     for(int j=p; j<=q; j++) c=c+arr[j];         
      printf("%d\n",c);
   }
   return 0;
 }