| ||||||||||
| 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 | |||||||||
先求和再取模,我是怎么WA的?#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;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator