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 |
st,ac code...In Reply To:改了,如下! Posted by:achilles at 2005-08-07 22:04:59 > #include<stdio.h> > #include<string.h> > > int main() > { > int a[200]; > char b[200]; > int i; > > for(i=0;i<200;i++) > a[i]=0; > while(1) > { > scanf("%s",b); > if(strcmp(b,"0")==0) > break; > strrev(b); > for(i=0;b[i]!='\0';i++) > a[i]+=(b[i]-'0'); > } > for(i=1;i<200;i++) > { > a[i]+=a[i-1]/10; > a[i-1]=a[i-1]%10; > } > for(i=199;a[i]==0;i--); > for(i;i>=0;i--) > printf("%d",a[i]); > 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