From 39680422a433174ec96ba37672cc29516bb61f58 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Wed, 14 Aug 2024 16:32:37 +0800 Subject: [PATCH] =?UTF-8?q?B2105=20=E7=9F=A9=E9=98=B5=E4=B9=98=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://www.luogu.com.cn/record/172635940 --- Luogu/B2105/B2105.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Luogu/B2105/B2105.cpp diff --git a/Luogu/B2105/B2105.cpp b/Luogu/B2105/B2105.cpp new file mode 100644 index 00000000..b9946c3c --- /dev/null +++ b/Luogu/B2105/B2105.cpp @@ -0,0 +1,47 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 105; + +int n, m, k; +int a[N][N], b[N][N], c[N][N]; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> n >> m >> k; + + for (int i = 1; i <= n; i++) { + for (int j = 1; j <= m; j++) { + cin >> a[i][j]; + } + } + + for (int i = 1; i <= m; i++) { + for (int j = 1; j <= k; j++) { + cin >> b[i][j]; + } + } + + for (int i = 1; i <= n; i++) { + for (int j = 1; j <= k; j++) { + for (int l = 1; l <= m; l++) { + c[i][j] += a[i][l] * b[l][j]; + } + } + } + + for (int i = 1; i <= n; i++) { + for (int j = 1; j <= k; j++) { + cout << c[i][j] << ' '; + } + + cout << endl; + } + + return 0; +}