Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <cstdlib>
- #include <bits/stdc++.h>
- #include <algorithm>
- #include <valarray>
- using namespace std;
- #define ll long long
- void sherry()
- {
- ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
- #endif
- }
- int main()
- {
- sherry();
- int x1, y1, x2, y2;
- cin >> x1 >> y1;
- int arr1[x1][y1];
- for (int i = 0; i < x1; i++)
- {
- for (int j = 0; j < y1; j++)
- {
- cin >> arr1[i][j];
- }
- }
- cin >> x2 >> y2;
- int arr2[x2][y2];
- for (int i = 0; i < x1; i++)
- {
- for (int j = 0; j < y1; j++)
- {
- cin >> arr2[i][j];
- }
- }
- ll sum[x1][y2];
- for (int i = 0; i < x1; i++)
- {
- for (int j = 0; j < y2; j++)
- {
- sum[i][j] = 0;
- for (int x = 0; x < y1; x++)
- {
- sum[i][j] += arr1[i][x] * arr2[x][j];
- }
- cout << sum[i][j] << " ";
- }
- cout << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement