[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
输入格式:
输入先后给出两个矩阵A和B。对于每个矩阵,首先在一行中给出其行数R和列数C,随后R行,每行给出C个整数,以1个空格分隔,且行首尾没有多余的空格。输入保证两个矩阵的R和C都是正数,并且所有整数的绝对值不超过100。
输出格式:
若输入的两个矩阵的规模是匹配的,则按照输入的格式输出乘积矩阵AB,否则输出Error: Ca != Rb,其中Ca是A的列数,Rb是B的行数。
输入样例1:
2 3 1 2 3 4 5 6 3 4 7 8 9 0 -1 -2 -3 -4 5 6 7 8
输出样例1:
2 4 20 22 24 16 53 58 63 28
输入样例2:
3 2 38 26 43 -5 0 17 3 2 -11 57 99 68 81 72
输出样例2:
Error: 2 != 3 #include<stdio.h> int main() { //定义所需的变量及数组1 int n1=0,m1=0; int
arr1[100][100]={0}; scanf("%d%d",&n1,&m1); for(int i=0;i<n1;i++) { for(int
j=0;j<m1;j++) { scanf("%d",&arr1[i][j]); } } //定义第二个变量与数组2 int n2=0,m2=0;
scanf("%d%d",&n2,&m2); int arr2[100][100]={0}; for(int i=0;i<n2;i++) { for(int
j=0;j<m2;j++) { scanf("%d",&arr2[i][j]); } } //判断是否能计算 int arr3[100][100]={0};
if(n2!=m1) { printf("Error: %d != %d",m1,n2); } else//此处进行计算 { for(int
i=0;i<n1;i++) { for(int j=0;j<m2;j++) { for(int k=0;k<m1;k++) {
arr3[i][j]+=arr1[i][k]*arr2[k][j];//找到规律 } } } //输出 printf("%d %d\n",n1,m2);
for(int i=0;i<n1;i++) { for(int j=0;j<m2;j++) { if(j!=m2-1) { printf("%d
",arr3[i][j]); } else { printf("%d",arr3[i][j]); } } printf("\n"); } } return
0; }