fork download
  1. #include<iostream>
  2. using namespace std;
  3. int H,W,a[10][10],c;
  4. int main(){
  5. cin>>H>>W;
  6. for(int i=0;i<H;i++){for(int j=0;j<W;j++){cin>>a[i][j];c+=a[i][j];}}
  7. cout<<c<<endl;
  8. return 0;
  9. }
Success #stdin #stdout 0s 3472KB
stdin
2 6
8 6 9 1 2 0
1 0 0 1 1 1
stdout
30