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

Envío 3196

Problema 0x25 - Suma de un subarreglo

  • Autor: DAHO
  • Fecha: 2021-02-27 19:16:41 UTC (Hace 5 meses)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.cpp:14:10: error: use of undeclared identifier 'answe'; did you mean 'answer'?
        cout<<answe<<endl;
              ^~~~~
              answer
main.cpp:12:10: note: 'answer' declared here
    long answer = 0;
         ^
1 error generated.

                    
#2
Error de compilación
                      main.cpp:14:10: error: use of undeclared identifier 'answe'; did you mean 'answer'?
        cout<<answe<<endl;
              ^~~~~
              answer
main.cpp:12:10: note: 'answer' declared here
    long answer = 0;
         ^
1 error generated.

                    
#3
Error de compilación
                      main.cpp:14:10: error: use of undeclared identifier 'answe'; did you mean 'answer'?
        cout<<answe<<endl;
              ^~~~~
              answer
main.cpp:12:10: note: 'answer' declared here
    long answer = 0;
         ^
1 error generated.

                    
#4
Error de compilación
                      main.cpp:14:10: error: use of undeclared identifier 'answe'; did you mean 'answer'?
        cout<<answe<<endl;
              ^~~~~
              answer
main.cpp:12:10: note: 'answer' declared here
    long answer = 0;
         ^
1 error generated.

                    
#5
Error de compilación
                      main.cpp:14:10: error: use of undeclared identifier 'answe'; did you mean 'answer'?
        cout<<answe<<endl;
              ^~~~~
              answer
main.cpp:12:10: note: 'answer' declared here
    long answer = 0;
         ^
1 error generated.

                    
#6
Error de compilación
                      main.cpp:14:10: error: use of undeclared identifier 'answe'; did you mean 'answer'?
        cout<<answe<<endl;
              ^~~~~
              answer
main.cpp:12:10: note: 'answer' declared here
    long answer = 0;
         ^
1 error generated.

                    
#7
Error de compilación
                      main.cpp:14:10: error: use of undeclared identifier 'answe'; did you mean 'answer'?
        cout<<answe<<endl;
              ^~~~~
              answer
main.cpp:12:10: note: 'answer' declared here
    long answer = 0;
         ^
1 error generated.

                    
#8
Error de compilación
                      main.cpp:14:10: error: use of undeclared identifier 'answe'; did you mean 'answer'?
        cout<<answe<<endl;
              ^~~~~
              answer
main.cpp:12:10: note: 'answer' declared here
    long answer = 0;
         ^
1 error generated.

                    
#9
Error de compilación
                      main.cpp:14:10: error: use of undeclared identifier 'answe'; did you mean 'answer'?
        cout<<answe<<endl;
              ^~~~~
              answer
main.cpp:12:10: note: 'answer' declared here
    long answer = 0;
         ^
1 error generated.

                    
#10
Error de compilación
                      main.cpp:14:10: error: use of undeclared identifier 'answe'; did you mean 'answer'?
        cout<<answe<<endl;
              ^~~~~
              answer
main.cpp:12:10: note: 'answer' declared here
    long answer = 0;
         ^
1 error generated.

                    
#11
Error de compilación
                      main.cpp:14:10: error: use of undeclared identifier 'answe'; did you mean 'answer'?
        cout<<answe<<endl;
              ^~~~~
              answer
main.cpp:12:10: note: 'answer' declared here
    long answer = 0;
         ^
1 error generated.

                    
#12
Error de compilación
                      main.cpp:14:10: error: use of undeclared identifier 'answe'; did you mean 'answer'?
        cout<<answe<<endl;
              ^~~~~
              answer
main.cpp:12:10: note: 'answer' declared here
    long answer = 0;
         ^
1 error generated.

                    
#13
Error de compilación
                      main.cpp:14:10: error: use of undeclared identifier 'answe'; did you mean 'answer'?
        cout<<answe<<endl;
              ^~~~~
              answer
main.cpp:12:10: note: 'answer' declared here
    long answer = 0;
         ^
1 error generated.

                    
#14
Error de compilación
                      main.cpp:14:10: error: use of undeclared identifier 'answe'; did you mean 'answer'?
        cout<<answe<<endl;
              ^~~~~
              answer
main.cpp:12:10: note: 'answer' declared here
    long answer = 0;
         ^
1 error generated.

                    
Puntos totales: 0 / 100

Código

#include<iostream>
using namespace std;

int main(){
  long n,c,p,q;
  cin>>n;
  int arr[n];
  for(int i=0;i<n;i++)cin>>arr[i];
  cin>>c;
  for(int i=0;i<c;i++){
  	cin>>p>>q;
    long answer = 0;
    for(int j=p;j<q;j++)answer+=arr[j];
  	cout<<answe<<endl;
  }
}