結果

問題 No.3224 2×2行列入門
ユーザー karinohito
提出日時 2025-10-16 02:56:21
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 2,989 ms
コンパイル使用メモリ 275,832 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-10-16 02:56:26
合計ジャッジ時間 4,650 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;



int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll A[2][2],B[2][2],C[2][2];
    for(int i=0;i<2;i++)for(int j=0;j<2;j++)cin>>A[i][j];
    for(int i=0;i<2;i++)for(int j=0;j<2;j++)cin>>B[i][j];
    for(int i=0;i<2;i++)for(int j=0;j<2;j++){
        C[i][j]=0;
        for(int k=0;k<2;k++)C[i][j]+=A[i][k]*B[k][j];
    };
    for(int i=0;i<2;i++)for(int j=0;j<2;j++){
        ll r=0;
        for(int k=0;k<2;k++)r+=C[i][k]*C[k][j];
        cout<<r<<" \n"[j==1];
    };
}
0