OpenJudge 2973 Skew数
1 #include<stdio.h> 2 int main() 3 { 4 int i,s,t,sum; 5 char skew[32]; 6 while(scanf("%s",skew)) 7 { 8 for(sum=t=i=0;skew[i];i++) 9 { 10 sum=(sum<<1)+skew[i]-'0'; 11 t+=skew[i]-'0'; 12 } 13 sum=(sum<<1)-t; 14 if(!sum) break; 15 printf("%d\n",sum); 16 } 17 return 0; 18 }