TopCoder

User's AC Ratio

100.0% (1/1)

Submission's AC Ratio

25.0% (1/4)

Tags

Description

小 M 在學習矩陣乘法,但是覺得矩陣的乘法很麻煩,不想要動手算,於是想請你幫忙。聰明的你想到可以用程式來解決矩陣乘法的問題,請你動動手幫助小 M 吧!

請在程式碼的第一行引入標頭檔 lib0596.h,並實作以下函數:

  • void mat_mul(int n, int m, int k, int mat1[][1000], int mat2[][1000], int result[][1000])
    • mat1 是一個 $n\times m$ 的矩陣,mat2 是一個 $m\times k$ 的矩陣。
    • 請將 mat1$\cdot$mat2 的結果存到 result 中。

注意請勿在你的程式碼宣告主函式 main() 以及進行任何輸入輸出的動作,否則將會發生不可預期的結果。
題目保證 $1\le n, m\le 1000$ ,且矩陣內每個元素 $a$ 滿足 $-1000\le a\le 1000$。

Input Format

本題沒有輸入,隨意輸入將會得到不可預期的結果。

Output Format

本題沒有輸出,隨意輸出將會得到不可預期的結果。

Sample Input 1

2 2 2
1 9
5 8
5 6
6 1

Sample Output 1

59 15
73 38

Sample Input 2

2 3 3
2 4 0
3 5 -4
-3 -2 2
-3 1 5
5 -3 -1

Sample Output 2

-18 0 24
-44 11 35

Sample Input 3

2 2 3
10 0
8 10
-7 -6 9
2 8 6

Sample Output 3

-70 -60 90
-36 32 132

Hints

測試用標頭檔
這裡提供一份本地測試用的標頭檔,你可以將其複製下來存檔成 lib0596.h#include "lib0596.h" 做使用。但請注意,這只是測試用的標頭檔,一些與解題無關的行為將會與 judge 上的有所不同,因此請不要嘗試任何與解題無關的行為,很可能會導致各種不可預期的後果。

Problem Source

Subtasks

No. Testdata Range Constraints Score
1 0~2 範例測資 0
2 0~11 無額外限制 100

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 2000 524288 65536 1 2
1 2000 524288 65536 1 2
2 2000 524288 65536 1 2
3 2000 524288 65536 2
4 2000 524288 65536 2
5 2000 524288 65536 2
6 2000 524288 65536 2
7 2000 524288 65536 2
8 2000 524288 65536 2
9 2000 524288 65536 2
10 2000 524288 65536 2
11 2000 524288 65536 2