http://acm.hdu.edu.cn/showproblem.php?pid=3787
View Code
#include"iostream"
using namespace std;
int main()
{
char a[1001],b[1001];
int c[1001],d[1001];
int i;
while(cin>>a>>b)
{
int L1=strlen(a);
int L2=strlen(b);
int start_a=1 , start_b=1;
int s=0,t=0;
for(i=0;i<L1;i++) if(a[i]>='0'&&a[i]<='9') c[s++]=a[i]-'0';
for(i=0;i<L2;i++) if(b[i]>='0'&&b[i]<='9') d[t++]=b[i]-'0';
if(a[0]=='-') start_a=-1;
if(b[0]=='-') start_b=-1;
int sum_a=0,sum_b=0;
for(i=0;i<s;i++)
{
sum_a+=c[i];
if(i<s-1) sum_a*=10;
}
for(i=0;i<t;i++)
{
sum_b+=d[i];
if(i<t-1) sum_b*=10;
}
cout<<start_a*sum_a+start_b*sum_b<<endl;
}
return 0;
}