JoyMozumder

b2d_1

Jul 24th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<math.h>
  4. int main()
  5. {
  6. long long int t,i,j,k,len;
  7. scanf("%lld",&t);
  8. getchar();
  9. for(i=1;i<=t;i++)
  10. {
  11. long long int count=0,sum=0;
  12. char a[100000];
  13.  
  14. gets(a);
  15. len=strlen(a);
  16. for(j=len-1;j>=0;j--)
  17. {
  18. sum+=((a[j]-48)*pow(2,count));
  19. count++;
  20. }
  21. printf("%lld\n",sum);
  22. }
  23. return 0;
  24. }
Add Comment
Please, Sign In to add comment