luogu#P10775. BZOJ4162 shlw loves matrix II
BZOJ4162 shlw loves matrix II
Background
Note: This problem is not a matrix fast exponentiation template problem.
Problem Description
Given a matrix , compute , and output each element modulo .
Input Format
The first line contains two integers , where is given in binary and may contain leading zeros.
The next lines describe a matrix .
Output Format
Output the matrix required in the description, using the same format as the input.
010 3
5 9 5
5 4 0
8 8 8
110 121 65
45 61 25
144 168 104
Hint
For of the testdata, , , and .
Translated by ChatGPT 5