fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n, count = 0, sum = 0, k;
  6. cin >> n;
  7. for (int i = 0; i < n * n; i++) {
  8. cin >> k;
  9. if (k < 0 && k % 2 == 0) {
  10. sum += k;
  11. count++;
  12. }
  13. }
  14. cout << count << " " << sum;
  15. return 0;
  16. }
Success #stdin #stdout 0s 15232KB
stdin
3
4 -2 5
1 -4 -12
0 1 -3
stdout
3 -18