#include<cstdio>
#include<cstring>
#include<cmath>
int main()
{
#ifdef LOCAL
freopen("in.txt","r",stdin);
#endif // LOCAL
char str[35];
while(gets(str))
{
if(str[0]=='0'&&str[1]=='\0')break;
int len_str = strlen(str);
int t = pow(2,len_str);
int sum = 0;
for(int i = 0; i < len_str; i++)
{
sum += (str[i]-'0')*(t-1);
t/=2;
}
printf("%d\n",sum);
}
return 0;
}
uva 575 - Skew Binary
最新推荐文章于 2017-09-06 09:20:28 发布