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 |
求救!!!!!!那位高手帮忙看看,我错在哪儿了! #include<string.h> #include<stdio.h> int main() { char s[10000000]; int i,temp,j,sum; while(scanf("%s",s)) { sum=0; if(strcmp(s,"0")==0) break; for(i=0;i<strlen(s);i++) sum=sum+s[i]-'0'; while(sum>=10) { i=0;temp=sum; while(temp>=10) { i=+temp%10; temp=temp/10; } i=i+temp; sum=i; } j=0;temp=0; while(j<strlen(s)) { if(temp<sum) { temp=temp*10+(s[j]-'0'); temp=temp%sum; j=j+1; } else { temp=temp+s[j]-'0';temp=temp%sum;j++; } } if(temp==0) {printf("%d\n",sum);} } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator