|
- #include <stdio.h>
- #include <string.h>
- int main(){
- char s[1000],*p;
- int n;
- while(scanf("%s",s)!=EOF){
- if(strcmp(s,"0")==0)
- break;
-
- while(strlen(s)>1){
- for(n=0,p=s;*p;p++)
- n+=*p-'0';
- sprintf(s,"%d",n);
- }
- printf("%s\n",s);
- }
- }
复制代码
这个是网上找的,找到了把我的代码数组换成1000我的也AC了,我的代码没有保存...
PS:384指的是Byte
数组要取1000
[ 本帖最后由 iptton 于 2006-12-22 21:17 编辑 ] |
|