"Everyday Learning" codevs1287 matrix multiplication

Source: Internet
Author: User

Reprint please specify the source [ametake Copyright]http://blog.csdn.net/ametake Welcome to see,

First question.

Title Description Description

Xiao Ming recently has a headache for linear algebra, and linear algebra is really abstract (and boring), but his teacher is talking about this section of matrix multiplication.
Of course, Xiao Ming dozing in class is no problem, but the linear algebra exercise is very scary. Xiao Ming wants you to help him finish the task.

Now give you an AI row AJ column matrix and a bi row BJ column matrix for you to find the product of their multiplication (and of course the matrix).
(Input data guarantee AJ=BI, no need to judge)

Definition of matrix multiplication:

1. When matrix A is multiplied by B, the number of columns of a =b must be required, otherwise the multiplication can not be performed. Therefore, matrix multiplication also does not satisfy the commutative law.

2. Set A is the matrix of X*n, B is the matrix of n*y, and each row of a is multiplied by each column of B to obtain a x*y matrix. For a row multiplied by a column, we call it a vector operation, where each number in the corresponding position is multiplied and then summed.

Written as a formula and:

C[I,J] = Sigma (a[i,k] * b[k,j])

Enter a description input Description

The input file has ai+bi+2 rows, and all of the input numbers are integers (within a long long range).
Line 1th: AI and AJ
Line 2~ai+2: All elements of matrix A
Line ai+3: Bi and BJ
Line ai+3~ai+bi+3: All elements of Matrix B

outputs description output Description

Product of the output matrix A multiply matrix B (Matrix C)

sample input to sample

2 2
12 23
45 56
2 2
78 89
45 56

Sample output Sample outputs

1971 2356
6030 7141

data size & Hint

Matrix Size <=200*200



The topic itself is very simple, here just to say the application of matrix multiplication.

Yesterday in the Zhucheng a summer camp listening to the Gao Tianyu predecessors, matrix multiplication can be combined with the multiplication of ideas to increase the multiplication of repeated calculations to a number of levels of complexity. Since the matrix multiplication satisfies the binding law, the transfer matrix can be doubled with the same fast power and then multiplied with the original matrix, which can greatly improve the running efficiency.


As for how to construct the transfer matrix = = The room is closing quickly too late to say = = if there is anyone (estimated no one) to see this article want to know (no one) can be private message I exchange =


In fact, the main thing is to spit groove a few words =

1.codevs yesterday compiler all kinds of fault what's going on three compilers all hung up

2.codevs game Juruo "Google Input method is not hit out = =" only to make the first question and only a sample and the first time also written wrong and still confused tune for one hours =

3.codevs first month race how to support it, but good trouble ah = = Feel Noip powerless Orz

4. Shandong summer Camp difficulty overall reduced by a b = = What is the situation this rhythm is serious wrong = = Visual inspection is not the province team Sir underestimated our level is the national team boss overestimated our level = = another, wyh god Ben said to be a teacher very tired = we listen to God Ben your class is also very tired =

5. These days suffered gty god Ben Halo, tree array segment tree RMQ matrix multiplication st Various new skills ... Not yet get= = but various eyes = =

6.GTY god Ben to be wyh god Ben all kinds of disregard (lifting n word hand are 54, my sense of existence must be used up in the morning Otz)

7. Afternoon Class A variety of sad drama = = Want to listen to the heuristic search for what the various are deleted = = re-return to the basic two difficulty, next door loi stride girl afraid to cry faint in the toilet = = (face)

8. Wish Ty and Captain Ca a pleasant base

9. See Xun 22 good happy, xboi new Girl Good, Zcyz last year a group of flower girl disappeared to this only, the mountain teacher attached to the god Ben Good silence do not know what injustice = = so far all kinds of happy, there is a star is better

10. Tomorrow also want to study hard, unconsciously half of the summer vacation ah = = See the Zhucheng one 1323 children so hard we also want to refuel AH =

11. I 12:30 the train came home the next morning to climb to Zhucheng easy?


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

"Everyday Learning" codevs1287 matrix multiplication

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.