#include<iostream>
#include"cstdio"
#include"string.h"
#include"cmath"
using namespace std;
typedef long long ll;
int main(){
char a[1000];
ll ans=0;
while(scanf("%s",a)!=EOF)
{
if(a[0]=='0') break;
int len=strlen(a),i,j;
ll ans=0;
for(i=len-1,j=1;i>=0;i--,j++)
ans+=(pow(2.0,j)-1)*(a[i]-48);
printf("%I64d\n",ans);
}
return 0;
}
poj 1565 题目说啥你就做啥!
最新推荐文章于 2018-08-05 21:16:30 发布