Răspuns :
#include <iostream>
int main()
{
static const int32_t TEMP = -1;
uint32_t * n = new uint32_t;
int32_t * st = new int32_t(TEMP);
int32_t * dr = new int32_t(TEMP);
std::cin >> (*n);
int32_t * v = new (std::nothrow) int [*n];
int32_t * suma = new int32_t(0);
for(size_t it = 0u; it != static_cast<size_t>(*n); ++it) {
std::cin >> v[it];
if((~v[it] & 1) && *st == TEMP)
*st = static_cast<int32_t>(it);
if(~v[it] & 1)
*dr = static_cast<int32_t>(it);
}
if(*st == *dr && *st == TEMP)
std::cout << "Nu exista\n";
else {
for(size_t it = *st; it <= static_cast<size_t>(*dr); ++it)
*suma += v[it];
std::cout << *suma << '\n';
}
delete n;
delete st;
delete dr;
delete suma;
delete[] v;
// by AntiEaglesDavids the Bossman
return 0;
}
int main()
{
static const int32_t TEMP = -1;
uint32_t * n = new uint32_t;
int32_t * st = new int32_t(TEMP);
int32_t * dr = new int32_t(TEMP);
std::cin >> (*n);
int32_t * v = new (std::nothrow) int [*n];
int32_t * suma = new int32_t(0);
for(size_t it = 0u; it != static_cast<size_t>(*n); ++it) {
std::cin >> v[it];
if((~v[it] & 1) && *st == TEMP)
*st = static_cast<int32_t>(it);
if(~v[it] & 1)
*dr = static_cast<int32_t>(it);
}
if(*st == *dr && *st == TEMP)
std::cout << "Nu exista\n";
else {
for(size_t it = *st; it <= static_cast<size_t>(*dr); ++it)
*suma += v[it];
std::cout << *suma << '\n';
}
delete n;
delete st;
delete dr;
delete suma;
delete[] v;
// by AntiEaglesDavids the Bossman
return 0;
}
#include <iostream>
using namespace std;
int main(){
int i,s=-1,e,v[100],n,sum=0;
cin>>n;
for(i=0;i<n;i++){
cin>>v[i];
if(v[i]%2==0){
if(s==-1)s=i;
e=i;
}
}
for(i=s;i<=e;i++)sum+=v[i];
cout<<sum;
}
using namespace std;
int main(){
int i,s=-1,e,v[100],n,sum=0;
cin>>n;
for(i=0;i<n;i++){
cin>>v[i];
if(v[i]%2==0){
if(s==-1)s=i;
e=i;
}
}
for(i=s;i<=e;i++)sum+=v[i];
cout<<sum;
}