Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iomanip>
- #include <iostream>
- #include <functional>
- #include <algorithm>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- long long int a[100000];
- long long sum = 0;
- for (int s = 0; s<n; s++)
- {
- cin >> a[s];
- sum += a[s];
- }
- int temp;
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j<n - 1; j++)
- if (a[j]>a[j + 1])
- {
- temp = a[j];
- a[j] = a[j + 1];
- a[j + 1] = temp;
- }
- }
- int r = 0;
- int q = -1;
- if (sum % 2 == 1)
- {
- while (r == 0 && q<n + 1)
- {
- q++;
- r = a[q] % 2;
- }
- sum = sum - a[q];
- }
- cout << sum;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement