#include
int main()
{
long a,b,c,d,n;
while(scanf("%d",&a)!=EOF)
{
n=0;
while(a!=123)
{
b=c=d=0;
while(a)
{
if(a%2) c++;
a/=10;
d++;
}
b=d-c;
a=100*b+10*c+d;
n++;
}
printf("%d\n",n);
}
return 0;
}
#include
int h(long) ;
int main(void)
{
long n;
int count=0;
clrscr();
printf("Please input the shuju:");
if((scanf("%ld",&n))==EOF)
{
printf("error");
exit(1);
}
while(h(n)!=123)
{
printf("%d\n",h(n));
count++;
n=h(n);
}
printf("%d\n",h(n));
printf("%d",++count) ;
getch();
}
int h(long n)
{
long iz=1,iy;
int b=0,c=0;
while(iz != 0)
{
iz=n/10;
iy=n%10;;
if((iy%2)==0)
b++;
else
c++;
n=iz;
}
return b*100+c*10+b+c;
}
我跑的是正确的啊。。。你是那种错误?tl还是pe?