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 <string.h> #include <stdio.h> #include <stdlib.h> char a[103]; int c[103]; int main() { int i,j; memset(c,0,103*sizeof(int)); while(gets(a)) { if(a[0]=='0') break; j=102; for(i=strlen(a)-1;i>=0;i--) { c[j]+=(a[i]-'0'); if(c[j]>=10) { c[j-1]+=c[j]/10; c[j]%=10; } j--; } memset(a,0,103*sizeof(char)); } for(i=0;i<103 && (!c[i]);i++); for(j=i;j<103;j++) printf("%d",c[j]); 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