题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=485
利用了九余定理:参考 http://blog.csdn.net/niushuai666/article/details/6856109
#include<stdio.h>
int main()
{
int m,n,d,t;
char a[30];
scanf("%d",&t);
getchar();
while(t--)
{
gets(a);
int i=0;
m=n=0;
while(a[i]!=' ') m+=a[i++]-'0';
while(a[++i]!='\0') n+=a[i]-'0';
d=m*n;
while(d>=10) d=d%10+d/10;
printf("%d\n",d);
}
return 0;
}