# include<stdio.h>
# include<string.h>
void main()
{
int i,j,n;
scanf("%d\n",&n);
for(j=0;j<n;j++){
int n1[100]={0},n2[100]={0},n3[100]={0},n4[100]={0},n5[101]={0},c1=0,c2=0,c=0,r1=0,r2=0,r=0,t=0,record=0,N=0;
char s1[100]={' '},s2[100]={' '};
gets(s1);
gets(s2);
c1=strlen(s1),c2=strlen(s2);
for(i=0;i<c1;i++){
if(s1[i]=='.') r1=i;}
for(i=0;i<c2;i++){
if(s2[i]=='.') r2=i;}
if(r1>=r2) r=r1;
else r=r2;
for(i=0;i<r1;i++){
n1[i]=s1[r1-1-i]-48;}
for(i=r1;i<c1-1;i++){
n2[i-r1]=s1[i+1]-48;}
for(i=0;i<r2;i++){
n3[i]=s2[r2-1-i]-48;}
for(i=r2;i<c2-1;i++){
n4[i-r2]=s2[i+1]-48;}
if((c1-1-r1)>=(c2-1-r2)) t=c1-1-r1;
else t=c2-1-r2;
for(i=0;i<r;i++){
n5[r-1-i]=n1[i]+n3[i];}
for(i=0;i<t;i++){
n5[r+i]=n2[i]+n4[i];}
for(i=0;i<r+t-1;i++){
n5[r+t-2-i]=n5[r+t-2-i]+n5[r+t-1-i]/10;
n5[r+t-1-i]=n5[r+t-1-i]%10;}
if(n5[0]>=10) N=n5[0]/10,n5[0]=n5[0]%10;
for(i=0;i<t;i++){
if(n5[r+t-1-i]==0) record++;
else break;}
if(N==0){
for(i=0;i<r+t+1-record;i++){
if(i<r) printf("%d",n5[i]);
if(i==r) printf(".");
if(i>r) printf("%d",n5[i-1]);}
}
if(N!=0){
for(i=0;i<r+t+2-record;i++){
if(i==0) printf("%d",N);
if(i>0&&i<r+1) printf("%d",n5[i-1]);
if(i==r+1) printf(".");
if(i>r+1) printf("%d",n5[i-2]);}
}
printf("\n");
if(j<n-1) scanf("\n");
}
}
我已经做出来,就是这个