Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- #include<string.h>
- int main()
- {
- long long l,i,sum,b,num;
- char s[100];
- while(gets(s))
- {
- sum=0;
- l=strlen(s);
- for(i=0;i<l;i++)
- {
- num=s[i]-'0';
- b=num*(pow(2,l-i)-1);
- sum=sum+b;
- }
- if(sum==0)
- break;
- printf("%lld\n",sum);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement