結果

問題 No.2441 行列累乗
ユーザー miya145592miya145592
提出日時 2023-08-25 21:36:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 922 ms
コンパイル使用メモリ 87,000 KB
実行使用メモリ 71,392 KB
最終ジャッジ日時 2023-08-25 21:36:56
合計ジャッジ時間 2,893 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,376 KB
testcase_01 AC 69 ms
71,084 KB
testcase_02 AC 68 ms
70,888 KB
testcase_03 AC 68 ms
71,004 KB
testcase_04 AC 67 ms
71,332 KB
testcase_05 AC 69 ms
71,088 KB
testcase_06 AC 70 ms
71,392 KB
testcase_07 AC 68 ms
71,164 KB
testcase_08 AC 69 ms
71,272 KB
testcase_09 AC 66 ms
71,300 KB
testcase_10 AC 66 ms
71,084 KB
testcase_11 AC 67 ms
71,284 KB
testcase_12 AC 66 ms
71,136 KB
testcase_13 AC 69 ms
71,320 KB
testcase_14 AC 66 ms
71,352 KB
testcase_15 AC 67 ms
71,328 KB
testcase_16 AC 66 ms
71,276 KB
testcase_17 AC 67 ms
71,104 KB
testcase_18 AC 64 ms
71,164 KB
testcase_19 AC 65 ms
71,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def matrix_mul(A, B):
    return [
        [A[0][0]*B[0][0] + A[0][1]*B[1][0], A[0][0]*B[0][1] + A[0][1]*B[1][1]],
        [A[1][0]*B[0][0] + A[1][1]*B[1][0], A[1][0]*B[0][1] + A[1][1]*B[1][1]]
    ]

M = [list(map(int, input().split())) for _ in range(2)]
ans = matrix_mul(matrix_mul(M, M), M)
for a in ans:
    print(*a)
0