杭电ACM(1013)

#include
#include
int main(void){
    char s[10000];//此处是坑,我之前设置为为s[1000],总是wrong answer
    int a=0,i,j=0;
    while(scanf("%s",s)!=EOF && strcmp(s,"0") != 0){
        j = strlen(s);
        for(i=0;i9){
                a = a/10 + a%10;
            }
        }
        printf("%d\n",a);
        a = 0;
    }
    return 0;
}

你可能感兴趣的:(杭电ACM(1013))