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. cin >> x;
  8. long long sc = 0, tl = 0;
  9. for (int i = 0; i <= n-1; i++)
  10. {
  11. cin >> x;
  12. if (x % 2 == 0)
  13. sc++;
  14. if (x % 2 == 1)
  15. tl+= x;
  16.  
  17.  
  18. }
  19. cout << sc << " " << tl;
  20. }
Success #stdin #stdout 0.01s 5272KB
stdin
5 
1 4 5 6 9
stdout
2 23