結果

問題 No.2441 行列累乗
ユーザー rlangevinrlangevin
提出日時 2023-08-27 14:47:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 1,554 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 71,136 KB
最終ジャッジ日時 2023-08-27 14:47:26
合計ジャッジ時間 2,673 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
70,984 KB
testcase_01 AC 64 ms
70,644 KB
testcase_02 AC 67 ms
70,984 KB
testcase_03 AC 69 ms
70,916 KB
testcase_04 AC 66 ms
70,648 KB
testcase_05 AC 67 ms
71,136 KB
testcase_06 AC 66 ms
70,968 KB
testcase_07 AC 68 ms
71,024 KB
testcase_08 AC 68 ms
71,024 KB
testcase_09 AC 68 ms
70,988 KB
testcase_10 AC 68 ms
70,772 KB
testcase_11 AC 65 ms
70,864 KB
testcase_12 AC 68 ms
71,004 KB
testcase_13 AC 69 ms
71,080 KB
testcase_14 AC 67 ms
70,648 KB
testcase_15 AC 65 ms
71,124 KB
testcase_16 AC 66 ms
70,980 KB
testcase_17 AC 67 ms
70,948 KB
testcase_18 AC 67 ms
70,944 KB
testcase_19 AC 79 ms
71,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

M = []
for i in range(2):
    M.append(list(map(int, input().split())))
    
def prod(A, B):
    C = [[0] * 2 for i in range(2)]
    for i in range(2):
        for j in range(2):
            for k in range(2):
                C[i][j] += A[i][k] * B[k][j]
    return C

M2 = prod(M, M)
M3 = prod(M2, M)
for m in M3:
    print(*m)
0