fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. short n, count = 0, summ = 0, mat[100][100];
  6. cin >> n;
  7. for (int i = 0; i < n * n; i++)
  8. cin >> mat[i / n][i % n];
  9. for (int i = 0; i < n * n; i++) {
  10. short elem = mat[i / n][i % n];
  11. if (elem % 2 == 0 && elem < 0) {
  12. count++;
  13. summ += elem;
  14. }
  15. }
  16. cout << count << ' ' << summ;
  17. return 0;
  18. }
Success #stdin #stdout 0s 15232KB
stdin
4
-25 0 12 5
-29 47 23 15
11 100 -89 20
55 25 42 -12
stdout
1 -12