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 |
Re:贴个挫代码(ac)In Reply To:贴个挫代码(ac) Posted by:799098386 at 2012-07-19 16:05:39 #include<stdio.h> #include<stdlib.h> #include<string.h> int main() { int t,i,j,k,g,h,n; char a[10001]; while(~scanf("%s",a)) { h=0; n=strlen(a); if(n==1 && a[0]=='0') break; else { for(i=0;i<n;i++) h=h+a[i]-'0'; h=h%9; if(h==0)printf("9\n"); else printf("%d\n",h); } }return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator