Cod sursa(job #3001403)
Utilizator | Sabaila Calin SabailaCalin | Data | 13 martie 2023 16:34:51 |
---|---|---|---|
Problema | Cuplaj maxim in graf bipartit | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.49 kb |
#include <iostream>
using namespace std;
int main()
{
ios :: sync_with_stdio(0);
cin.tie(0);
int n, a[1001];
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> a[i];
}
int first = 1;
while (a[first] % 2 != 1)
{
first++;
}
int last = n;
while (a[last] % 2 != 1)
{
last--;
}
int sum = 0;
for (int i = first; i <= last; i++)
{
sum += a[i];
}
cout << sum;
}