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 |
谁帮忙看看啊!就是一直WA#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator