50180. Matrix Multiplication

I'm a slow walker, but I never walk backwards.

Task Description

Given two $n$ by $n$ square matrices $A$ and $B$, write a program to compute the matrix $C = AB$.

Every row of $A$, $B$, and $C$ will be stored sequentially in one file. All file names for a matrix have the same prefix, and end with its row index start from $1$ to $n$. For example, if the prefix for $A$ is sample1A, then the first row of $A$ will be stored in a file sample1A1. All elements in $A$ and $B$ are int32_t, and the elements of $C$ are int64_t. You should compute $C$ and store it in files.

Input Format (stdin)

The first line is the size of the matrices, $n$. The second to the fourth lines are the filename prefix for $A$, $B$ and $C$ respectively. The length of all prefixes are less than 20.

  • $n \leq 30 $

Output Format

You should write $C$ into files in the same file name convention as $A$ and $B$, but with type int64_t.

Sample Input 1

download here .tar.gz / .zip

stdin

3
sample1A
sample1B
sample1C

input files

sample1A1
sample1A2
sample1A3
sample1B1
sample1B2
sample1B3

output files

sample1C1
sample1C2
sample1C3

Sample Input 2

download here .tar.gz / .zip

stdin

3
sample2A
sample2B
sample2C

input files

sample2A1
sample2A2
sample2A3
sample2B1
sample2B2
sample2B3

output files

sample2C1
sample2C2
sample2C3

Discussion