这是我用C++做的杭电ACM的1002题,到底是哪错了,为什么老是通不过啊,还有应该怎样改正呢?
http://acm.hdu.edu.cn/showproblem.php?pid=1002
#include<iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
char c[20][1002],d[20][1002],s[20][1002],*a[20],*b[20];
int T,i,j,k,l[20];
cin>>T;
for(i=0;i<T;i++)
{
cin>>c[i]>>d[i];
a[i]=c[i];
b[i]=d[i];
while(*a[i]=='0')++a[i];
while(*b[i]=='0')++b[i];
for(j=0;a[i][j]!='\0';++j);
for(k=0;b[i][k]!='\0';++k);
s[i][0]='0';
for(l[i]=0;j>0&&k>0;++l[i])
{
s[i][l[i]]+=(a[i][--j]-'0')+(b[i][--k]-'0');
if(s[i][l[i]]>='9')
{
s[i][l[i]+1]='1';//进位
s[i][l[i]]-=10;
}
else
s[i][l[i]+1]='0';//反之设为0
}
while(j>0)
{
s[i][++l[i]]=a[i][--j];
}
while(k>0)
{
s[i][++l[i]]=b[i][--k];
}
}
for(i=0;i<T;i++)
{
if(i)cout<<endl;
cout<<"Case "<<i+1<<":"<<endl<<a[i]<<" + "<<b[i]<<" = ";
while(s[i][l[i]]=='0')--l[i];
for(j=l[i];j>=0;--j)
{
cout<<s[i][j];
}
cout<<endl;
}
return 0;
}