fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n, a, sum = 0;
  6. cin >> n;
  7. for(int i = 0; i < n * n; i++){
  8. cin >> a;
  9. if(a > 0){
  10. sum += a;
  11. }
  12. }
  13. cout << sum;
  14. return 0;
  15. }
Success #stdin #stdout 0s 15232KB
stdin
5
89 76 54 32 33
46 57 89 40 32
12 45 63 78 65 
13 76 54 89 67
13 67 89 90 43 
stdout
1412