Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

TLE 求大神解释

Posted by guojiale at 2015-05-05 22:41:34 on Problem 1504
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator