题目:http://acm.hdu.edu.cn/showproblem.php?pid=3787
直观的说 ,这个数据比较小可以直接进行 int赋值,或者是用longlong类型 。
#include<stdio.h>
#include<string.h>
long str(char s[])
{
int i;long t=0;
for(i=0;i<strlen(s);i++)
if(s[i]>='0'&&s[i]<='9')
t=t*10+(s[i]-'0');
if(s[0]=='-')
t=-t;
return t;
}
void main()
{
char aa[100],bb[100];
while(scanf("%s%s",aa,bb)!=-1)
printf("%ld\n",str(aa)+str(bb));
}