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:seedeed at 2011-03-07 23:42:38 #include <cstdio> #include <cstring> #include <iostream> using namespace std; char a[2000]; int sum,l,i; int main() { while(scanf("%s",a)&&strcmp(a,"0")!=0) { sum=0; l=strlen(a); for(i=0;i<l;i++) sum+=a[i]-'0'; sum=sum%9; printf("%d\n",sum); } return 0; } 这怎么就会WA了呢? Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator