fork 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
3
4 -2 5
1 -4 -12
0 1 -3
stdout
11