#P3390. 【模板】矩阵快速幂
【模板】矩阵快速幂
Description
Given an matrix , compute .
Input Format
The first line contains two integers .
Then follow lines, each containing integers. In row , the -th number denotes .
Output Format
Output .
There are lines in total, each containing numbers. The number in row and column denotes . Each element is taken modulo .
2 1
1 1
1 1
1 1
1 1
3 5
1 2 3
4 5 6
7 8 9
121824 149688 177552
275886 338985 402084
429948 528282 626616
Hint
Constraints
For of the testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号