回分類題庫
d183: CP Lab Exercise: Matrix
出處:

Difficulity : N/A
Accepted : 67 Times | Submit :195 Times | Clicks : 1726
Accepted : 59 Users | Submit : 60 Users | Accepted rate : 98%
Time Limit :10000 ms | Memory Limit : 64000 KBytes
題目加入時間 : 2010-11-03 16:08

Content :

Back to high school math, matrix addition is always an important chapter.
Now you have learn how to programming, so that you can give this task to the computer.
Your task is to write a program which can do matrix addition of two 3x3 matrix for you!

Notice:
You have to use 2D array and write a function to pass the exercise.
void addition( int a[][3], int b[][3]);
Please print out matrix in above function.
 

Input :

The first line is a positive number N: the number of the sets of matrix to be added.
The following 18 lines are the data of two matrix.
Your job is to do matrix addition.
You can assume the inputs are valid.

Output :

For each set of input, you have to output a 3x3 matrix.

Sample Input :

1
2
8
2
10 
12
3
11
1
2
1
3
2
3
3
9
8
7
7

Sample Output :

3 5 4
13 15 12
19 8 9

Hint :


  

Author :


  Solve it!   Status Forum (0)

C++
C
JAVA
76808. alun0922 (6 ms , 360KB)
38838. cp100703009 (2 ms , 220KB)
30712. nothinglo (2 ms , 228KB)
26273. timetraveler (2 ms , 226KB)
26272. cp99703046 (2 ms , 232KB)
26111. cp98703063 (2 ms , 228KB)
50765. nwgs524513cja (82 ms , 166KB)

執行時間會受很多因素影響因此僅供參考,主機等級請看這裡