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:简单的方法!!!!! Posted by:pktop at 2009-08-01 15:00:04 > /* Note:Your choice is C IDE */ > #include <iostream> > using namespace std; > int main() > { > int a[1200],i,n,sum=0; > char b[1200]; > while(1){ > scanf("%s",b); > if(b[0]==48) > break; > n=strlen(b); > for(i=0;i<n;i++){ > a[i]=b[i]-48; > sum+=a[i]; > if(sum>=10) > sum=sum-10+1; > } > printf("%d\n",sum); > sum=0;} > return 0; > } > > > > Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator