| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
why wrong?自己电脑上运行都好好的。。。高手看下
#include <iostream>
#include <string>
using namespace std;
int main()
{
int num;
int a[100][100],b[100][100],temp[100][100];
bool fst;
scanf("%d",&num);
while (num>0)
{
int maxnum;
fst=true;
int m,n,fstm,fstn,secn;
scanf("%d",&maxnum);
while (maxnum>0)
{
memset(temp,0,sizeof(temp));
scanf("%d %d",&m,&n);
if (fst==false&&(m!=fstn||m!=secn))
{break;
}
for (int i=0;i<m;i++)
{
for (int j=0;j<n;j++)
{
if (fst)
{
scanf("%d",&a[i][j]);
fstm=m;
fstn=n;
}
else
{
scanf("%d",&b[i][j]);
secn=n;
}
}
}
if (fst==false)
{
for (int i=0;i<fstm;i++)
{
for (int j=0;j<secn;j++)
{
for (int k=0;k<fstn;k++)
{
temp[i][j]+=a[i][k]*b[k][j];
}
}
}
memcpy(a,temp,sizeof(temp));
}
fst=false;
maxnum--;
}
for (int i=0;i<fstm;i++)
{
for (int j=0;j<secn;j++)
{
printf("%d ",a[i][j]);
if (j==secn-1)
printf("\n");
}
}
printf("\r\n");
num--;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator