| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
哪位给看看,怎么总是输出超限#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int n,i,j,a,b,t1,t2,k;
int c=0;
long int sum;
char str1[10],str2[10],str3[10],str4[10];
scanf("%d",&n);
while(n--)
{
for(i=0; i<n; i++)
{
scanf("%s %s",str1,str2);
a=strlen(str1);
b=strlen(str2);
for(j=a-1; j>=0; j--)
{
str3[c]=str1[j];
c++;
}
str3[c]='\0';
t1=atoi(str3);
c=0;
for(j=b-1; j>=0; j--)
{
str4[c]=str2[j];
c++;
}
str4[c]='\0';
t2=atoi(str4);
sum=t1+t2;
c=0;
while(sum>0)
{
k=sum%10;
if(k==0)
{
sum=sum/10;
continue;
}
else
printf("%d",k);
sum=sum/10;
}
printf("\n");
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator