9 条题解
-
0
#include<bits/stdc++.h> #define ll long long using namespace std; ll a[505][505],b[505][505]; const ll mod=1000000007; ll n,m,p; inline ll read(){** ll a=0,k=1; char c=getchar(); while (!('0'<=c&&c<='9')){ if (c=='-'){ k*=-1; } c=getchar(); } while ('0'<=c&&c<='9'){ a=a*10+c-'0'; c=getchar(); } return a*k; } int main(){ n=read(),p=read(),m=read(); for (ll i=1;i<=n;i++){ for (ll j=1;j<=p;j++){ a[i][j]=read(); } } for (ll i=1;i<=p;i++){ for (ll j=1;j<=m;j++){ b[i][j]=read(); } } for (ll i=1;i<=n;i++){ for (ll j=1;j<=m;j++){ ll tmp=0; for (ll k=1;k<=p;k++){ tmp=(tmp+(a[i][k]*b[k][j]+mod)%mod+mod)%mod; } printf("%lld ",tmp); } putchar('\n'); } return 0; }
信息
- ID
- 60
- 时间
- 2000ms
- 内存
- 256MiB
- 难度
- 3
- 标签
- 递交数
- 802
- 已通过
- 202
- 上传者