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

谁帮忙看看啊!就是一直WA

Posted by 19106118 at 2006-11-29 21:02:59 on Problem 1503
#include <stdio.h>
#include <string.h>
int main()
{
    char a[110],b[110];
    int k,i,j,jin,p,y;
    for(i=0;i<110;i++)*(a+i)=48;
    while(EOF!=scanf("%s",&b))
    {
        k=strlen(b);
        y=k;
        j=109;jin=0;
        for(i=109;i>=0;i--)
        {
            if(k>0)
            {
                *(a+i)=*(a+i)+*(b+k-1)+jin-48;
                k--;
            }
            if(k<=0)
            {
                *(a+i)=*(a+i)+jin;
            }
            if(*(a+i)>=58)
            {
                *(a+i)=*(a+i)-10;
                jin=1;
            }
            else jin=0;
        }
        if(*b==48&&y==1)
        {
            p=0;
            for(i=0;i<110;i++)
            {
                if(*(a+i)!=48)
                for(j=i;j<110;j++)
                {
                    printf("%c",*(a+j));
                    p=1;
                }
                if(p==1)
                {
                    printf("\n");
                    break;
                }
            }
            if(p==0)printf("0\n");
            for(i=0;i<110;i++)*(a+i)=*(b+i)=48;
        }
    }
    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