給一個行列相等的矩陣,請將矩陣翻轉後,再次方,並輸出
定義:
矩陣翻轉
$\left [ \begin{array}{1} a_{11} & a_{12} & a_{13}\\a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{array}\right]翻轉後 \implies \left [ \begin{array}{1} a_{11} & a_{21} & a_{31} \\a_{12} & a_{22} & a_{32} \\ a_{13} & a_{23} & a_{33} \end{array}\right]$
矩陣乘法
矩陣 $A = \left [ \begin{array}{1} a_{11} & a_{12}\\a_{21} & a_{22}\end{array}\right],\; B = \left [ \begin{array}{1} b_{11} & b_{12}\\b_{21} & b_{22}\end{array}\right]$
則 $AB = \left [ \begin{array}{1} a_{11}\times b_{11} + a_{12}\times b_{21} & a_{11}\times b_{12} + a_{12}\times b_{22}\\a_{21}\times b_{11} + a_{22}\times b_{21} & a_{21}\times b_{12} + a_{22}\times b_{22}\end{array}\right]$
矩陣次方
矩陣 $A = \left [ \begin{array}{1} a_{11} & a_{12}\\a_{21} & a_{22}\end{array}\right]$
則$A = \left [ \begin{array}{1} a_{11} & a_{12}\\a_{21} & a_{22}\end{array}\right]^3=\left [ \begin{array}{1} a_{11} & a_{12}\\a_{21} & a_{22}\end{array}\right] \times \left [ \begin{array}{1} a_{11} & a_{12}\\a_{21} & a_{22}\end{array}\right] \times \left [ \begin{array}{1} a_{11} & a_{12}\\a_{21} & a_{22}\end{array}\right]$
第一行有一正整數$t$,代表有t筆測資
第二行有兩正整數$n$和$m$,代表矩陣行列數皆為$n$,且要將翻轉後的矩陣$m$次方
輸出翻轉並次方後的矩陣
每筆測資輸出結束要換行
矩陣內所有數都要$mod 1000000007$($mod$為取餘數)
2 2 2 1 2 3 4 3 2 1 2 3 4 5 6 7 8 9
7 15 10 22 30 66 102 36 81 126 42 96 150
所有測資
保證題目提供的初始矩陣所有數字大小都屬於$\{1,2,3,4,5\}$的集合中
$1 \leq t \leq 10$
$1 \leq n \leq 10$
前40%測資
$1 \leq m \leq 2$
前80%測資
$1 \leq m \leq 5$
100%測資
$1 \leq m \leq 10$
編號 | 身分 | 題目 | 主題 | 人氣 | 發表日期 |
沒有發現任何「解題報告」 |