| ||||||||||
| 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 | |||||||||
TLE 求大神解释#include <stdio.h>
#include <stdlib.h>
#include<string.h>
int main()
{
int n,i,j;
char str[100];
int fin[104];
scanf("%d",&n);
while(n--)
{
memset(fin,0,sizeof(fin));
int len,t=2;
while(t--){
scanf("%s",str);
len=strlen(str);
int temp=0,c;
for(i=len-1,j=0;i>=0;i--,j++)
{
c=str[i]-'0'+fin[j]+temp;
temp=c/10;
fin[j]=c%10;
}//for
while(temp>0)
{
c=temp+fin[j];
fin[j]=c%10;
temp=c/10;
j++;
}
}//while(t)
i=103;
while(fin[i]==0)
i--;
while(i!=-1)
{
printf("%d\n",fin[i]);
i--;
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator