1521 - I2P18_EECS_Assignment_3 Scoreboard

Time

2018/10/08 11:26:00 2018/10/08 11:58:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11142 Matrix Multiplication
11169 Star
11611 Addition and Division of Big Number

11142 - Matrix Multiplication   

Description

Compute C = A × B, where AB and C are matrices of size n × mm × p, and n × p, respectivily.

Input

There are multiple (50) test cases in each data set.

Each case begins with a line of three integers nm and p, which denote the dimensions of the matrices defined in the problem description. Each of the following n lines contains m integers aij, representing the elements in matrix A, and then m lines of p integers bij, representing the elements in matrix B.

There is a blank line between two successive test cases, and the input is terminated by end-of-file.

 

For data set #1, 1 ≤ nmp ≤ 5 and |aij|, |bij| ≤ 30.

For data set #2, 1 ≤ nmp ≤ 20 and |aij|, |bij| ≤ 500.

For data set #3, 1 ≤ nmp ≤ 50 and |aij|, |bij| ≤ 7000.

For data set #4, 1 ≤ nmp ≤ 100 and |aij|, |bij| ≤ 10000.

Output

For each test case, output n lines of p integers representing the elements of matrix C.

Please use single space to seperate two successive elements in the same line, and do not output any leading or trailing space characters.

Also, please output a blank line after each matrix.

Sample Input  Download

Sample Output  Download

Tags




Discuss




11169 - Star   

Description

Given two integers N and M, and a starting point with coordinates (x, y). You are asked to create an N-by-M matrix as follows.

  • Find the matrix element for the starting point, that is, with row index x and column index y, and set this element’s value as 'S'.
  • For a matrix element other than the starting point, if its row index is x or its column index is y, then set its value as '+'.
  • If a matrix element is on the diagonal line of the starting point, then set its value as '*'.
  • For all other matrix elements, set their values as '-'. 

Input

Four integers separated by blanks. The first integer (N) represents that the matrix has N rows. The second integer (M) represents that the matrix has M columns. The third integer (X) and the fourth integer (Y) represent the coordinates of the starting point.

( 1 <=N,M<= 15, 0 <= X < N, 0 <= Y < M )

 

Note that (0, 0) is on the most top-left of the matrix.

Output

The N-by-M matrix. Print the elements of the matrix using the format "%c". Each row is ended with a newline character '\n'.

Sample Input  Download

Sample Output  Download

Tags




Discuss




11611 - Addition and Division of Big Number   

Description

As we all know, all kinds of data type like int, long, etc have their limitation in representing numbers. 

For instance, if we use int to store some variable, it may not contain the value we want if the variable is bigger than 231, which is roughly the same as 2 * 109.

So it would get into trouble if we want to calculate some very large number, like 101000 + 1.

In this task, you are asked to implement a calculator that can make some simple calculation of big number possible.

For simplifying the question, we will give you several data groups containing two big numbers a and b, and a integer divisor c.  For each group, all we need is the integer part of (a + b)/c.

Hint: 

You can recall the very first experiment you learned addition. At that time the teacher may tell you that you should calculate the addition in each digit , only maintain the very right digit as the answer and send the others as the carry to the next digit. For instance, if we want to calculate 999 + 999, the following method might be well:

   9  9  9

   9  9  9

           +

-------

   8  8  8 (right most digit)

1  1  1      (carry)

           +

--------

1  9  9  8

You may use int array to record the big number and the upper method to calculate.

 

For division, you can also use some likely method.

We do the division from the very left digit of dividend(被除數) , calculate the result and pass the reminder to the right digit.

For instance, if we want to calculate 199 / 2:

             9    9

    ——————

2 )1     9     9

      1     8

   ————————

             1      9

             1      8

   ————————

                    1    

Characters in red are reminders.

 

Other better method is encouraged.

 

 

Input

The input contains several lines.

The very first line is a integer N representing the total times of calculation. (1 <= N < 50)

From the second line to the last line, each three lines forms a group representing a calculation. 

The first line and the second line of each group are two numbers, which are in decimal, bigger than or equal to 0 and smaller than 101000. For making the question easier, the lengths of the two numers are just the same. It is possibe for the numbers beginning with 0.

The third line of each group is the divisor (bigger than 0 and smaller than 231-1).

Output

The answer of each group.

Please do not pad 0 in your answer. Eg 87 is a legel answer but 087 is illegal.

You should add a newline at the end of the answer.

Sample Input  Download

Sample Output  Download

Tags




Discuss