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 |
自己想了个办法处理关于9的问题#include <cstdio> #include <string.h> using namespace std; int main() { char buf[2000]; while(scanf("%s",buf),(buf[0]!='0')) { int len=strlen(buf); int tot=0; for(int i=0;i<len;i++) tot+=buf[i]-'0'; printf("%d\n",(tot-1)%9+1); } getchar();getchar(); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator