fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main () {
  4. long long n;
  5. cin >> n;
  6. long long x;
  7. long long sc = 0, tl = 0;
  8. for (int i = 1; i <= n; i++)
  9. {
  10. cin >> x;
  11. if (x % 2 == 0)
  12. sc++;
  13. if (x % 2 == 1)
  14. tl+= x;
  15.  
  16.  
  17. }
  18. cout << sc << " " << tl;
  19. }
Success #stdin #stdout 0s 5324KB
stdin
5
1 4 5 6 9
stdout
2 15