You are viewing a single comment's thread. Return to all comments →
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while(t--) { int n, m; cin >> n >> m; vector<vector<int>> a(n, vector<int> (m)), b(n, vector<int> (m)), res(n, vector<int> (m)); for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) cin >> a[i][j]; for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) cin >> b[i][j]; for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) res[i][j] = a[i][j] + b[i][j]; for(auto i: res) { for(auto j: i) cout << j << " "; cout << endl; } } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Operator Overloading
You are viewing a single comment's thread. Return to all comments →