大水题。。。。
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<math.h>
using namespace std;
int main(){
int arr[40];
char s[40];
while (gets(s)){
if (strcmp(s, "0") == 0)
break;
int l = strlen(s), sum = 0;
for(int i = 0; i < l; i++)
arr[i] = s[i] - '0';
int k = l;
for(int i = 0; i < l; i++)
sum += arr[i] * (pow(2, k--) - 1);
printf("%d\n", sum);
}
return 0;
}