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

Envío 973

Problema 0x25 - Suma de un subarreglo grande

  • Autor: juantamayo26
  • Fecha: 2020-10-05 06:47:42 UTC (Hace alrededor de 4 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.cpp:17:13: error: subscripted value is not an array, pointer, or vector
      ans+=a[i];
           ~^~
1 error generated.

                    
#2
Error de compilación
                      main.cpp:17:13: error: subscripted value is not an array, pointer, or vector
      ans+=a[i];
           ~^~
1 error generated.

                    
#3
Error de compilación
                      main.cpp:17:13: error: subscripted value is not an array, pointer, or vector
      ans+=a[i];
           ~^~
1 error generated.

                    
#4
Error de compilación
                      main.cpp:17:13: error: subscripted value is not an array, pointer, or vector
      ans+=a[i];
           ~^~
1 error generated.

                    
#5
Error de compilación
                      main.cpp:17:13: error: subscripted value is not an array, pointer, or vector
      ans+=a[i];
           ~^~
1 error generated.

                    
#6
Error de compilación
                      main.cpp:17:13: error: subscripted value is not an array, pointer, or vector
      ans+=a[i];
           ~^~
1 error generated.

                    
#7
Error de compilación
                      main.cpp:17:13: error: subscripted value is not an array, pointer, or vector
      ans+=a[i];
           ~^~
1 error generated.

                    
#8
Error de compilación
                      main.cpp:17:13: error: subscripted value is not an array, pointer, or vector
      ans+=a[i];
           ~^~
1 error generated.

                    
#9
Error de compilación
                      main.cpp:17:13: error: subscripted value is not an array, pointer, or vector
      ans+=a[i];
           ~^~
1 error generated.

                    
#10
Error de compilación
                      main.cpp:17:13: error: subscripted value is not an array, pointer, or vector
      ans+=a[i];
           ~^~
1 error generated.

                    
#11
Error de compilación
                      main.cpp:17:13: error: subscripted value is not an array, pointer, or vector
      ans+=a[i];
           ~^~
1 error generated.

                    
#12
Error de compilación
                      main.cpp:17:13: error: subscripted value is not an array, pointer, or vector
      ans+=a[i];
           ~^~
1 error generated.

                    
#13
Error de compilación
                      main.cpp:17:13: error: subscripted value is not an array, pointer, or vector
      ans+=a[i];
           ~^~
1 error generated.

                    
#14
Error de compilación
                      main.cpp:17:13: error: subscripted value is not an array, pointer, or vector
      ans+=a[i];
           ~^~
1 error generated.

                    
Puntos totales: 0 / 100

Código

#include<iostream>
using namespace std;
int a[100];

int main(){
  int n;
  cin>>n;
  for(int i=0; i<n; i++){
    cin>>a[i];
  }
  int c;
  cin>>c;
  while(c--){
    int a,b,ans=0;
    cin>>a>>b;
    for(int i=a; i<=b; i++){
      ans+=a[i];
    }
    cout<<ans<<endl;
  }
  return 0;
}