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 |
改了,如下!In Reply To:路过的。。行行好,,感激你。。。考虑了 开头 有0的整数,还错。。help.. Posted by:SilenceIowyh at 2005-08-07 21:56:16 #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