From 8244370d9c660279149f7547d91f9d69706269ca Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Fri, 29 Apr 2022 07:47:10 +0800 Subject: [PATCH] =?UTF-8?q?#100.=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://loj.ac/s/1451310 --- LibreOJ/100/100.cpp | 68 ++++++++++++++++++++++++++++++++++++++++++ LibreOJ/100/data/0.in | 3 ++ LibreOJ/100/data/0.out | 3 ++ LibreOJ/100/data/1.in | 3 ++ LibreOJ/100/data/1.out | 3 ++ LibreOJ/100/data/2.in | 3 ++ LibreOJ/100/data/2.out | 3 ++ LibreOJ/100/data/3.in | 3 ++ LibreOJ/100/data/3.out | 3 ++ LibreOJ/100/data/4.in | 3 ++ LibreOJ/100/data/4.out | 3 ++ LibreOJ/100/data/5.in | 3 ++ LibreOJ/100/data/5.out | 3 ++ LibreOJ/100/data/6.in | 3 ++ LibreOJ/100/data/6.out | 3 ++ LibreOJ/100/data/7.in | 3 ++ LibreOJ/100/data/7.out | 3 ++ LibreOJ/100/data/8.in | 3 ++ LibreOJ/100/data/8.out | 3 ++ LibreOJ/100/data/9.in | 3 ++ LibreOJ/100/data/9.out | 3 ++ 21 files changed, 128 insertions(+) create mode 100644 LibreOJ/100/100.cpp create mode 100644 LibreOJ/100/data/0.in create mode 100644 LibreOJ/100/data/0.out create mode 100644 LibreOJ/100/data/1.in create mode 100644 LibreOJ/100/data/1.out create mode 100644 LibreOJ/100/data/2.in create mode 100644 LibreOJ/100/data/2.out create mode 100644 LibreOJ/100/data/3.in create mode 100644 LibreOJ/100/data/3.out create mode 100644 LibreOJ/100/data/4.in create mode 100644 LibreOJ/100/data/4.out create mode 100644 LibreOJ/100/data/5.in create mode 100644 LibreOJ/100/data/5.out create mode 100644 LibreOJ/100/data/6.in create mode 100644 LibreOJ/100/data/6.out create mode 100644 LibreOJ/100/data/7.in create mode 100644 LibreOJ/100/data/7.out create mode 100644 LibreOJ/100/data/8.in create mode 100644 LibreOJ/100/data/8.out create mode 100644 LibreOJ/100/data/9.in create mode 100644 LibreOJ/100/data/9.out diff --git a/LibreOJ/100/100.cpp b/LibreOJ/100/100.cpp new file mode 100644 index 00000000..eb75075c --- /dev/null +++ b/LibreOJ/100/100.cpp @@ -0,0 +1,68 @@ +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 1005, + mod = 1e9 + 7; + +int n, m, p; + +class Matrix { + private: + int data[N][N]; + + public: + Matrix() { + memset(data, 0x00, sizeof(data)); + } + + int* operator[](int i) { + return data[i]; + } + + Matrix operator*(Matrix b) const { + Matrix c; + + for (int i = 1; i <= n; i++) { + for (int j = 1; j <= p; j++) { + for (int k = 1; k <= m; k++) { + c[i][j] = (c[i][j] + 1ll * data[i][k] * b[k][j] % mod) % mod; + } + } + } + + return c; + } +} a, b, c; + +int main() { + std::ios::sync_with_stdio(false); + + cin >> n >> m >> p; + + 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 <= p; j++) { + cin >> b[i][j]; + } + } + + c = a * b; + + for (int i = 1; i <= n; i++) { + for (int j = 1; j <= p; j++) { + cout << (c[i][j] % mod + mod) % mod << ' '; + } + cout << endl; + } + + return 0; +} diff --git a/LibreOJ/100/data/0.in b/LibreOJ/100/data/0.in new file mode 100644 index 00000000..d6800110 --- /dev/null +++ b/LibreOJ/100/data/0.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d79570896204c55a15ac5d77ff699605ad98129f5d1a80abc8445650358d6825 +size 25 diff --git a/LibreOJ/100/data/0.out b/LibreOJ/100/data/0.out new file mode 100644 index 00000000..fb9e5752 --- /dev/null +++ b/LibreOJ/100/data/0.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:432d4c631b6830fcb46def2a78952f3cd94bc093c5070133e7da977d13457469 +size 10 diff --git a/LibreOJ/100/data/1.in b/LibreOJ/100/data/1.in new file mode 100644 index 00000000..257ea76e --- /dev/null +++ b/LibreOJ/100/data/1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1ecfdf45c2c7422dba3d8deb75992158abd705b0bb321917d28db8e0e394d82 +size 337 diff --git a/LibreOJ/100/data/1.out b/LibreOJ/100/data/1.out new file mode 100644 index 00000000..d2be8887 --- /dev/null +++ b/LibreOJ/100/data/1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:593f830b26fd49f26e45123f4eb20e2a81c9ec849a241c409c3575d7ca2a291c +size 146 diff --git a/LibreOJ/100/data/2.in b/LibreOJ/100/data/2.in new file mode 100644 index 00000000..20fccf02 --- /dev/null +++ b/LibreOJ/100/data/2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8896ba0692ec58c8db185e2a92bfc910c54ffb619bd1c744070f0da8c7b6e945 +size 2077 diff --git a/LibreOJ/100/data/2.out b/LibreOJ/100/data/2.out new file mode 100644 index 00000000..307c31be --- /dev/null +++ b/LibreOJ/100/data/2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:240246718f15382361e647def07d75d68e45166577c90281bfa1bb90829cf36d +size 985 diff --git a/LibreOJ/100/data/3.in b/LibreOJ/100/data/3.in new file mode 100644 index 00000000..73dd6e1a --- /dev/null +++ b/LibreOJ/100/data/3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f1727123559f27d00819f0e1711c8ac03b8afbb7f8303f144c7e9de7ac0ea7f8 +size 8342 diff --git a/LibreOJ/100/data/3.out b/LibreOJ/100/data/3.out new file mode 100644 index 00000000..ca73b6ee --- /dev/null +++ b/LibreOJ/100/data/3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f967fcd36b60c635fe79dfe6692895c21fda5fea3c07a4ccd49ebd904f711b52 +size 2966 diff --git a/LibreOJ/100/data/4.in b/LibreOJ/100/data/4.in new file mode 100644 index 00000000..30116fbb --- /dev/null +++ b/LibreOJ/100/data/4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5a0346c8d0781ee5a360920bc9b0a11c94be65a42f5eae033e9e43e8d5c22b5 +size 84121 diff --git a/LibreOJ/100/data/4.out b/LibreOJ/100/data/4.out new file mode 100644 index 00000000..2b67c2b9 --- /dev/null +++ b/LibreOJ/100/data/4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:efd3465b381de52d1d3e23ae6619d9a7e63779b2906acc41c9b6af54e188a643 +size 17813 diff --git a/LibreOJ/100/data/5.in b/LibreOJ/100/data/5.in new file mode 100644 index 00000000..661c3ed2 --- /dev/null +++ b/LibreOJ/100/data/5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c1e587c70251b1158b10058d5668f16e2e27ab948c444a1b8414b053930316a2 +size 1315059 diff --git a/LibreOJ/100/data/5.out b/LibreOJ/100/data/5.out new file mode 100644 index 00000000..6e0f7f95 --- /dev/null +++ b/LibreOJ/100/data/5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92a23313a22d9853c91f337f7ee138724cb44986a330d4069d3100926c769c2a +size 921592 diff --git a/LibreOJ/100/data/6.in b/LibreOJ/100/data/6.in new file mode 100644 index 00000000..40f8e6c8 --- /dev/null +++ b/LibreOJ/100/data/6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6b67354a01bc4f1abf0963c3ad668c229597d0fd9c868d32b0f17af6eaf6c55 +size 5194618 diff --git a/LibreOJ/100/data/6.out b/LibreOJ/100/data/6.out new file mode 100644 index 00000000..f5a0f44b --- /dev/null +++ b/LibreOJ/100/data/6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:42e0ec38a283b65a90e352cc78e3792d443827d9a4794e7f50a647bb5ce2aeae +size 2472085 diff --git a/LibreOJ/100/data/7.in b/LibreOJ/100/data/7.in new file mode 100644 index 00000000..8de96dd4 --- /dev/null +++ b/LibreOJ/100/data/7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15814546baa6f9c040a606e2fdc8b1a9caa20268c10b412e06a6c64e97789818 +size 5188 diff --git a/LibreOJ/100/data/7.out b/LibreOJ/100/data/7.out new file mode 100644 index 00000000..b505e3ef --- /dev/null +++ b/LibreOJ/100/data/7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b0049c438f198f21c190f173eac5cb468693ee2b4b2643cf36b018cdf83059f +size 4964 diff --git a/LibreOJ/100/data/8.in b/LibreOJ/100/data/8.in new file mode 100644 index 00000000..20597590 --- /dev/null +++ b/LibreOJ/100/data/8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:510983f2a73c75f7e1f75287c1a910292a278753cd40710d27ea14a8b6a8aa6d +size 2119817 diff --git a/LibreOJ/100/data/8.out b/LibreOJ/100/data/8.out new file mode 100644 index 00000000..9a94db9f --- /dev/null +++ b/LibreOJ/100/data/8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:36946da2b1e2dc4bf04b0c6b08f479fbf6c3beb0a92d960849096476b54bbf97 +size 49470 diff --git a/LibreOJ/100/data/9.in b/LibreOJ/100/data/9.in new file mode 100644 index 00000000..553ede42 --- /dev/null +++ b/LibreOJ/100/data/9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb5de8f24ffa90de183948041c51904b3c2d1108867bfc6cac0b3c61cdba1649 +size 5193620 diff --git a/LibreOJ/100/data/9.out b/LibreOJ/100/data/9.out new file mode 100644 index 00000000..f229506d --- /dev/null +++ b/LibreOJ/100/data/9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6fcc6ea96b6643b42e9220f0f31c066554c4dee7e2e62275737610facb9a38bc +size 2472117