fork download
  1. /*
  2. Task: Problem 7.09
  3. Date: Dec 24, 2020
  4. Author: aLittleLove (Minh Vu)
  5. */
  6.  
  7. #include<bits/stdc++.h>
  8.  
  9. using namespace std;
  10.  
  11. int main()
  12. {
  13. ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  14. //freopen("input.txt","r",stdin);
  15. int m, n; cin >> m >> n;
  16. vector<vector<float> > a(m, vector<float>(n));
  17. vector<vector<float> > b(m, vector<float>(n));
  18. for (int i=0; i<m; i++)
  19. for (int j=0; j<n; j++)
  20. cin >> a[i][j];
  21. cin >> m >> n;
  22. for (int i=0; i<m; i++)
  23. for (int j=0; j<n; j++)
  24. cin >> b[i][j];
  25. for (int i=0; i<m; i++)
  26. {
  27. for (int j=0; j<n; j++)
  28. {
  29. a[i][j] += b[i][j];
  30. cout << a[i][j] << " ";
  31. }
  32. cout << '\n';
  33. }
  34. return 0;
  35. }
Success #stdin #stdout 0s 4888KB
stdin
8 13

9 0 7 0 5 8 9 5 8 5 3 7 4

5 5 3 1 1 0 8 5 0 5 6 8 3

2 8 3 5 1 2 6 6 9 3 0 7 1

3 7 1 9 3 2 6 2 6 6 6 8 5

9 2 0 0 3 7 8 5 1 2 1 5 4

2 1 9 7 2 8 0 5 6 1 1 6 9

1 0 0 5 6 2 7 5 1 0 5 3 3

7 1 7 6 5 6 4 2 2 0 4 7 8

8 13

7 4 4 4 5 0 9 9 2 7 9 4 8

7 7 2 2 0 7 4 9 9 1 8 0 6

8 5 6 7 2 9 5 0 4 9 8 7 3

8 7 8 1 0 7 6 8 7 9 0 7 9

1 6 5 2 8 1 6 4 1 7 9 0 2

1 8 9 1 9 2 1 7 7 1 9 3 4

1 1 5 2 5 0 8 7 7 4 8 0 3

8 3 7 8 7 5 6 0 6 9 4 4 1
stdout
16 4 11 4 10 8 18 14 10 12 12 11 12 
12 12 5 3 1 7 12 14 9 6 14 8 9 
10 13 9 12 3 11 11 6 13 12 8 14 4 
11 14 9 10 3 9 12 10 13 15 6 15 14 
10 8 5 2 11 8 14 9 2 9 10 5 6 
3 9 18 8 11 10 1 12 13 2 10 9 13 
2 1 5 7 11 2 15 12 8 4 13 3 6 
15 4 14 14 12 11 10 2 8 9 8 11 9