牛客国庆集训派对Day2 A 矩阵乘法(简单)

版权声明:哈哈哈哈哈哈哈哈哈哈哈哦吼~~ https://blog.csdn.net/threeh20/article/details/82927734

https://www.nowcoder.com/acm/contest/202/A

你以为评测机跑的慢吗

那你就大错特错啦!

代码是转的。。。

#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
  
int n,p,m;
int A[5000][70],B[70][5000];
long long ans;
  
  
int main() {
    scanf("%d%d%d",&n,&p,&m);
  
    for(int i=1; i<=n; i++) for(int j=1; j<=p; j++) scanf("%x",&A[i][j]);
    for(int i=1; i<=m; i++) {
        for(int j=1; j<=p; j++) {
            int t;
            scanf("%1d",&t);
            B[j][i]=t;
        }
    }
    for(int i=1; i<=n; i++) {
        for(int j=1; j<=m; j++) {
            long long tans=0;
            for(int k=1; k<=p; k++) {
                tans+=A[i][k]*B[k][j];
            }
            ans^=tans;
        }
    }
    cout<<ans;
    return 0;
}

猜你喜欢

转载自blog.csdn.net/threeh20/article/details/82927734