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 |
几行代码ac,纪念下#include "cstdio" int main() { char buff[1000]; int sum; while(scanf("%s",buff),buff[0]!='0') { sum=0; for(int i=0;buff[i];i++) sum+=buff[i]-'0'; while(sum>9) sum=sum/10+sum%10; 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