Question meaning This question I guess many people are stuck on the question meaning, shit, a lot of formulas. Give an N*N matrix and 3 ∗ 3 3*33∗3 matrix, initially to the3 * 3 * 3 33∗3 The matrix is K', if you want to convert to K, you only need to add the sum of the corresponding elements/matrix elements. Define matrix C (A, K) = C (C [A] [K], K) C(A,K)=C(C[A][K],K)C(A,K)=C(C[A][K],K) C [ A ] [ K ] C[A][K] C [ A ] [ K ] is calculated as follows: TakeA [i] [j] A[i][j]A [ i ] [ j ] as3 ∗ 3 3*33∗3 The upper left corner of the matrix, expand to the lower right to3 ∗ 3 3*33∗A matrix of 3 , if it goes out of the boundary, the default is 0. Then this3 ∗ 3 3*33∗The matrix of 3 and the givenK (3 ∗ 3) K(3*3)K(3∗3 ) , the elements at the corresponding positions are multiplied to find a sum as a newA [i] [j] A[i][j]A [ i ] [ j ] value, traverse each element of A, and do so. In this way, the A matrix has been updated once, so that the matrix A after countless times is obtained.
Thinking K 'certainly is only one element is not zero, so as to ensure the elements of K and is 1. If K is not an element A [1] [1] 1 of, then finally the matrix A is 0, Each operation is equivalent to moving the element in A to the left or up or to the top left, and it will definitely be filled with 0 after countless times. If the element that is 1 in K is A[1][1], then A remains unchanged.
In addition, the data of this question is out of water, too watery, despite this, post the code.